I have a file that has about 63000 row I need to grep though
[root@server]# cat missinglinks.txt 69870 1.pdf.Published 125098 2.png.Published 125022 3.pdf.Published 69867 4.png.Published I have a list of 450 numbers that will match some of the row in the missinglinks.txt file
[root@server]# cat missinglinksA.sh 125105 125104 125103 125102 125100 125099 125098 125097 125022 I am trying to use a script to take the first row from missinglinksA.sh and grep missinglinks.txt and output to a file, then the second, n.....
for n in $(cat missinglinksA.txt) do cat missinglinks.txt | grep $n done I would like an output file like:
[root@server]# cat missinglinksAout.txt 125098 2.png.Published 125022 3.pdf.Published I cannot however get the output either on the screen or to a text file, I am not sure if I am doing something wrong or if the script is simply not outputing.
I have -o -i none seem to fix the issue.
I can do:
[root@server]# cat missinglinksA.txt | grep 125098 >> missinglinksAout.txt And it works.
[root@server]# cat missinglinksAout.txt 125098 2.png.Published I have taken the top 10 rows from the missinglinksA.txt file and made a script to check each line and that does not work either, blank output.
[root@server]# cat missinglinksAtesteachline.sh cat missinglinksA.txt | grep 125105 cat missinglinksA.txt | grep 125104 cat missinglinksA.txt | grep 125103 cat missinglinksA.txt | grep 125102 cat missinglinksA.txt | grep 125100 cat missinglinksA.txt | grep 125099 cat missinglinksA.txt | grep 125098 cat missinglinksA.txt | grep 125097 cat missinglinksA.txt | grep 125022 [root@server]# sh missinglinksAtesteachline.sh [root@server]#
while read -r line ; do ; grep pattern $line >> /tmp/output_result.$(date +%Y%m%d).txt ; done < inputfileYou can also search on the stackexhange "read huge file" maybe to get more methods and find the best for your needs.