Oct 8, 2003 #1 chomps303 MIS Joined Sep 30, 2003 Messages 83 Location US Why won't this work? clear echo "Enter Search String \c" read search echo "Enter Filename to Search \c" read filename fln=`awk '/$search/{printf "%d\n",NR}' $filename` echo "Line Number =" $fln Thanks Brandt
Why won't this work? clear echo "Enter Search String \c" read search echo "Enter Filename to Search \c" read filename fln=`awk '/$search/{printf "%d\n",NR}' $filename` echo "Line Number =" $fln Thanks Brandt
Oct 8, 2003 #2 Annihilannic MIS Joined Jun 22, 2000 Messages 6,317 Location AU $search will not be expanded to the value of the variable because it is between single quotes. Try: fln=`awk '/'"$search"'/{printf "%d\n",NR}' $filename` Annihilannic. Upvote 0 Downvote
$search will not be expanded to the value of the variable because it is between single quotes. Try: fln=`awk '/'"$search"'/{printf "%d\n",NR}' $filename` Annihilannic.