Let me start by saying that I do not want to print only repeating lines and do not want to delete them.
I am trying to use grep with a template file to parse a large data file.
A template file, for example, might look like this:
1243 1234 1234 1234 1354 1356 1356 1677
etc .. with more single and duplicate entries.
The input file may look like this:
aatta 1243 qqqqqq yyyyy 1234 vvvvvv ttttt 1555 bbbbbb ppppp 1354 pppppp yyyyy 3333 zzzzzz qqqqq 1677 eeeeee iiiii 4444 iiiiii
etc .. for 27,000 lines.
when i use
grep -f 'Patternfile.txt' 'Inputfile.txt' > 'Outputfile.txt'
I get an output file that resembles this:
aatta 1243 qqqqqq yyyyy 1234 vvvvvv ppppp 1354 pppppp
how could I make it also report duplicates so that I get something like this?
aatta 1243 qqqqqq yyyyy 1234 vvvvvv yyyyy 1234 vvvvvv yyyyy 1234 vvvvvv ppppp 1354 pppppp qqqqq 1677 zzzzzz
In addition, I would also like to print an empty line if the request in the template file does not match the substring in the input file.
Thanks!
source share