help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to run an awk command on file in emacs - using minGW on Windows


From: Angus Comber
Subject: How to run an awk command on file in emacs - using minGW on Windows
Date: Tue, 17 Sep 2013 11:39:59 +0100

If I am visiting a file in emacs I want to be able to run a simple awk
command, eg

    awk /Sam/ test.txt

How would I construct this.

I tried:

    m-! - to be able to run a shell cmd

    awk '/Sam/' 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

I also tried awk "/Sam/" test.txt and get same error.

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]