A small grep
code I used to use very often is not working as before. Bellow there is an example in which I have a data set with 7 rows and 3 columns, the dataset is named animal.txt:
Animal Habitat Family
Bear forest Ursidae
Dog house Canidae
Cat house Fenidae
Wolf mountain Canidae
Eagle mountain Accipitridae
Lion sabana Fenidae
I have a list with the names of 3 animals. What I want is to extract the lines that contains those names of animals. The list is named animal3.txt.
Dog
Cat
Bear
Both the dataset and the list are tab delimited files. The code I am using is:
grep -w -F -f ./animal3.txt ./animal.txt > ./output.txt
The output only have the line of Bear
I have searched in several forums and haven't find something similar. I really don't know what is going on or what I am doing wrong.
animal.hmp.txt
is a typo, since you earlier stated the filename wasanimal.txt
? Also, all three./
are unnecessary. This means the file in the current directory, which is already implicit. – Sparhawk Mar 17 '18 at 00:42cat -et animal3.txt
– steeldriver Mar 17 '18 at 00:42