Article 54KP8 [SOLVED] AWK - Word search

[SOLVED] AWK - Word search

by
Pinguino99
from LinuxQuestions.org on (#54KP8)
hi, i have a little problem in the code, if don't find the word it doesn't change to second condition

What is wrong?

File
Code:1: zzz|zzz|bbb|[X]|999|222
2: xxx|xxx|bbb|[Y]|999|222Code:FILE=~/path/file

read -p "word: " STRING
if
awk -F '|' '{if($4 && NR==1) print $4~/^\['$STRING']/}' $FILE ; then
echo "found"
else
echo "not found"
filatest?d=yIl2AUoC8zA latest?i=K6udDi1S1b4:Vf3paoIp1A4:F7zBnMy latest?i=K6udDi1S1b4:Vf3paoIp1A4:V_sGLiP latest?d=qj6IDK7rITs latest?i=K6udDi1S1b4:Vf3paoIp1A4:gIN9vFwK6udDi1S1b4
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