0

I have two text files, one with 100,000 strings and the other with 1,000 strings, which are already present in the larger file. I'd like to subtract those 1,000 strings, so that the larger file will then contain only 99,000. This is not about removing duplicates, rather stripping out strings.

Is there a command to do so.

  • Which operating system are you running? This looks like something you could do over Linux command line with several different methods. – drkblog Apr 28 '14 at 0:40
  • Win XP, I'm afraid... – george Apr 28 '14 at 1:05
  • Can you provide samples of both files with smaller size and what the expected results are? – R Sahu Apr 28 '14 at 2:12
  • Would you consider installing MSYS in your Windows? – drkblog Apr 28 '14 at 2:33
  • I would install MSYS! – george Apr 28 '14 at 2:42
0

If the strings are all on separate lines, you can use grep from MSYS or cygwin as follows:

C:\> grep -v -f thousandLine.txt hundred000line.txt >ninetynine000Line.txt

The -v option inverts the match so that the output is all lines in hundred000line.txt that don't match any line in thousandLine.txt. See the grep manual for more information.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.