I am new to grep and awk - using Windows 7 (I downloaded grep and awk for windows from GnuWin).
I am have having trouble running this script:
grep -Fwf dictionary.txt frequency.txt | awk '{print $2 "," $1}'
I get the error:
awk: '{print
awk: ^ invalid char ''' in expression
I believe it might have something to do with having to use double quotes in Windows, but I tried all the combinations I can think of and still it doesn't work.
Can anyone help? Thanks
Escaping command line items is always a pain on Windows. As a last resort you could probably use gawk -f
!
So: your file script.awk
contains:
print $2,$1
And you do grep -Fwf dictionary.txt frequency.txt | awk -f script.awk