all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to run an awk command on file in emacs - using minGW on Windows
@ 2013-09-17 10:39 Angus Comber
  2013-09-17 11:19 ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Angus Comber @ 2013-09-17 10:39 UTC (permalink / raw)
  To: Emacs Help

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-09-18 15:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-17 10:39 How to run an awk command on file in emacs - using minGW on Windows Angus Comber
2013-09-17 11:19 ` Eli Zaretskii
2013-09-17 16:41   ` Angus Comber
2013-09-17 17:20     ` Eli Zaretskii
2013-09-18  9:55       ` Angus Comber
2013-09-18 10:13         ` Eli Zaretskii
2013-09-18 13:52           ` Angus Comber
2013-09-18 15:00             ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.