[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to run an awk command on file in emacs - using minGW on Windows
From: |
Eli Zaretskii |
Subject: |
Re: How to run an awk command on file in emacs - using minGW on Windows |
Date: |
Tue, 17 Sep 2013 14:19:56 +0300 |
> Date: Tue, 17 Sep 2013 11:39:59 +0100
> From: Angus Comber <anguscomber@gmail.com>
>
> 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.
"M-! awk /Sam/ test.txt" (without the quotes) works for me.
> 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
You are using MSYS tools from a native Windows Emacs, and you are
paying the price.
> I also tried awk "/Sam/" test.txt and get same error.
Right, MSYS does that with both flavors of quotes.
> Running just awk '{ print }' test.txt works
Because the argument doesn't start with a slash.
> I am running on Windows 7 using minGW and my shell is set to:
>
> echo %SHELL%
> C:/MinGW/msys/1.0/bin/bash.exe
That's your problem: why do you set shell to the MSYS Bash? I suggest
not to do that. Leave it at the default.
> How do I escape the /Sam/ ? It thinks it is part of the directory to the
> exe I think?
Yes.
Try this:
awk ' /Sam/' test.txt
i.e. an extra blank before the first slash.
But I really suggest not to use MSYS tools from Emacs. There are
native (MinGW) ports available.
- How to run an awk command on file in emacs - using minGW on Windows, Angus Comber, 2013/09/17
- Re: How to run an awk command on file in emacs - using minGW on Windows,
Eli Zaretskii <=
- Re: How to run an awk command on file in emacs - using minGW on Windows, Angus Comber, 2013/09/17
- Re: How to run an awk command on file in emacs - using minGW on Windows, Eli Zaretskii, 2013/09/17
- Re: How to run an awk command on file in emacs - using minGW on Windows, Angus Comber, 2013/09/18
- Re: How to run an awk command on file in emacs - using minGW on Windows, Eli Zaretskii, 2013/09/18
- Re: How to run an awk command on file in emacs - using minGW on Windows, Angus Comber, 2013/09/18
- Re: How to run an awk command on file in emacs - using minGW on Windows, Eli Zaretskii, 2013/09/18