BOTH pipe and file(s) into awk

Hello all,
quick question:
is it possible to pass input into AWK BOTH with a pipe AND a file at the same time, something like this:

command .......|awk '.................' FILEIN > fileout

All I read says either one or the other, not both, is it at all possible?
And how would the different stream be differentiated inside of awk?
It would be a great help to find out how.
Thanks

I would do this :slight_smile:

 
cat FILEIN; command .......|awk '.................' > fileout

You can if you make awk treat stdin as a regular file:

command | awk '...' file - > fileout

You could differentiate between the two by using NR==FNR or FILENAME=="-"

1 Like