I am trying to print the filename with the output of the command below
less $file|awk -F' ' '{print '$file' $2,$3,$5}
it prints without the variable value
x y z
a b c
I want to print
file1 x y z
file1 a b c
I am trying to print the filename with the output of the command below
less $file|awk -F' ' '{print '$file' $2,$3,$5}
it prints without the variable value
x y z
a b c
I want to print
file1 x y z
file1 a b c
Try:
awk -F' ' '{print FILENAME " " $2 " " $3 " " $5}' $file
FILENAME is a built-in variable of awk, representing the input filename.