Timeline for Is there a tool to get the lines in one file that are not in another?
Current License: CC BY-SA 3.0
12 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Oct 13, 2020 at 13:39 | comment | added | Quasímodo |
The options can be collapsed together to get a shorter version: grep -Fxvf fileB fileA.
|
|
| Oct 5, 2017 at 6:06 | comment | added | Caleb |
@TonyCesaro That would work if your data set is not order specific and duplicates don't need to be taken into account. The advantage of using diff is that position in the file gets taken into account.
|
|
| Oct 4, 2017 at 15:22 | comment | added | Tony Cesaro |
To account for the sort problem, you could use process substitution in the command to process each file before the grep as needed. Example: grep -F -x -v -f <(sort fileB) <(sort fileA)
|
|
| May 8, 2017 at 13:58 | history | edited | Caleb | CC BY-SA 3.0 |
consolidate grep + sed into just sed
|
| Oct 16, 2015 at 17:33 | comment | added | rogerdpack | be careful, grep -f is O(N^2) I believe: stackoverflow.com/questions/4780203/… | |
| Aug 27, 2013 at 21:46 | comment | added | Caleb |
@inderpreet99 The lower case -u argument does actually take a parameter of a number as long as it is not followed by a space. The advantage of the way I had it before is that it will work with or without a value, so you could use something in that sub command routine that returned not output. Upper case '-U' on the other hand requires an argument.
|
|
| S Aug 27, 2013 at 17:59 | history | suggested | inderpreet99 | CC BY-SA 3.0 |
corrected diff parameter (-u doesn't take any options, -U is the right flag)
|
| Aug 27, 2013 at 17:58 | review | Suggested edits | |||
| S Aug 27, 2013 at 17:59 | |||||
| S Feb 21, 2012 at 4:02 | history | suggested | Kevin Cox | CC BY-SA 3.0 |
Explained how the command works.
|
| Feb 21, 2012 at 3:16 | review | Suggested edits | |||
| S Feb 21, 2012 at 4:02 | |||||
| Jan 2, 2012 at 15:57 | vote | accept | daisy | ||
| Jan 2, 2012 at 13:57 | history | answered | Caleb | CC BY-SA 3.0 |