help on awk

Hi,

I do not understand the following line of code:

 awk --file awkfile < file1 > file1.out

The content of awkfile as

-bash-3.00$ cat awkfile
 / 04/

Can anyone please describe it bit elaborately?

Thanks,
Siba

its searching for the patter " 04" without quotes from the file "file1" and if found, redirect those records to "file1.out"

alternative way is:

awk '/ 04/ {print}' file1 > file1.out

or

awk '/ 04/ {print $0 > "file1.out" }' file1
1 Like