RHEL6.10 , gnu grep 2.2
grep -vfF stem.txt source.txt > filteredoutput.txt
stem.txt
has unique 13 digit numbers.
source.txt
is fixed length (400) data file where the 13 digit field value starts at position 225. The field values are unique in the file. Newline character is the line separator in both cases.
source.txt
has about 80k lines, stem.txt
about 4.5k
HOWEVER, my output file has around 75k lines, meaning it has filtered more than in the stem file.
I could not figure out why this happens.
While troubleshooting, I replaced everything else in each line in source.txt
except the number field with spaces and then it gives the correct result. Very confusing behavior.
- Not sure how I can figure it out?
- What are my other options -sed /awk equivalents.
EDIT: Hail grep! Issue was with the user/me. Due to a oversight I did not account for the possibility of a special sequence of 13 digits that might appear elsewhere in the source file. The grep command with its arguments worked as expected.
grep
without-v
and see if it's output is more lines thanstem.txt
.