Using awk I have an index file which has been seperated into 5 fields. The first field contains file names. What I need to do is check to see if a file exists in my current directory that is not in the first field of my index file. If its not i print out a message.
Please help!
What's your shell?
With zsh/ksh93 and bash you can do something like this:
awk 'NR == FNR { f[$1]; next }
!($1 in f) { print $1,"found on filesystem, but not in list!" }
' index_file <(IFS=$'\n';printf "%s\n" *)
im using fedora7 terminal.......im fairly new to linux...
Good,
did you try it?
for i in *
do
nawk -v f="$i" 'BEGIN{n=0}
{
if ($1==f)
n=1
}
END{
if(n==0)
print f":not exist"
} ' filename
done