If I am visiting a file in emacs I want to be able to run a simple awk command, eg
awk /Sam/ { print $0 }.
How would I construct this.
I tried:
m-! - to be able to run a shell cmd
awk '/Sam/ { print $0 }' test.txt
But then I get this error:
awk: c:/MinGW/msys/1.0/Sam/ { print }
awk: ^ syntax error
awk: c:/MinGW/msys/1.0/Sam/ { print }
awk: ^ syntax error
errcount: 2
Running just awk '{ print }' test.txt works
I am running on Windows 7 using minGW and my shell is set to:
echo %SHELL%
C:/MinGW/msys/1.0/bin/bash.exe
How do I escape the /Sam/ ? It thinks it is part of the directory to the exe I think? I tried (trying gawk to see if get better diagnotic msg):
gawk '\/Sam\/ { print $0 }' test.txt
gawk: cmd. line:1: \/Sam\/ { print }
gawk: cmd. line:1: ^ backslash not last character on line
test.txt file contains:
Angus
Lisa
Samuel
Annabel
Jack
Wookie