Article 4VA9S While loop

While loop

by
Drosera_capensis
from LinuxQuestions.org on (#4VA9S)
Hello everyone,

I am not familiar with while loops, and meet some difficulties with my first script using one.

I try to print all the rows in the first column of a file matching a list of names.

the syntax of the script is:
Code:cat list | while read f;
do
awk '{ if ($1 == "$f" ) { print } }' file ;
doneI have tested the awk command alone, and the loop itself with another command (echo $f), and it is working fine.

But for some reason, the while loop with the command awk is not working.
Would you have any idea what could be the error here?latest?d=yIl2AUoC8zA latest?i=-jvwDwXxTV0:KI_UKhW7Xu4:F7zBnMy latest?i=-jvwDwXxTV0:KI_UKhW7Xu4:V_sGLiP latest?d=qj6IDK7rITs latest?i=-jvwDwXxTV0:KI_UKhW7Xu4:gIN9vFw-jvwDwXxTV0
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments