From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Angus Comber Newsgroups: gmane.emacs.help Subject: How to run an awk command on file in emacs - using minGW on Windows Date: Tue, 17 Sep 2013 11:39:59 +0100 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1379414415 7404 80.91.229.3 (17 Sep 2013 10:40:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 17 Sep 2013 10:40:15 +0000 (UTC) To: Emacs Help Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Sep 17 12:40:21 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VLshg-0004zG-7u for geh-help-gnu-emacs@m.gmane.org; Tue, 17 Sep 2013 12:40:20 +0200 Original-Received: from localhost ([::1]:39237 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLshf-00027g-T1 for geh-help-gnu-emacs@m.gmane.org; Tue, 17 Sep 2013 06:40:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53970) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLshS-00025J-EY for help-gnu-emacs@gnu.org; Tue, 17 Sep 2013 06:40:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VLshN-00059z-MM for help-gnu-emacs@gnu.org; Tue, 17 Sep 2013 06:40:06 -0400 Original-Received: from mail-pa0-x22c.google.com ([2607:f8b0:400e:c03::22c]:40195) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLshN-00059O-Ev for help-gnu-emacs@gnu.org; Tue, 17 Sep 2013 06:40:01 -0400 Original-Received: by mail-pa0-f44.google.com with SMTP id fz6so6607475pac.17 for ; Tue, 17 Sep 2013 03:40:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=j570ZlKjEOBhsyQc/ObfS5Ft7OxgMrzHkMrqFBSxe8w=; b=KLjqb+5TmRIWUrg8hCkF9hiLUeVghj0GTHVYHclynPD5hwWjxnrTy2DQiKt57Pr9vu EWLxJyTeWCBMRl+fTLe1uvwYJpV44gzAekNXMXGeBwvmb+4F8GK2/rRVjrDMPNZAArzl y6RrpauGjMKTuoLNMn3tsoH9yRuFAdjv6zjPmBzTxbBD6yS1n6QxtRx1yDHX9YMt/loH 5AVsDVF70zn2830YPBv49mSQvSthABjipYWfMTxeQBazmjucDN80qSMQOikNOh5BT2r+ Xi944sksmR5C9bC+znvt+q/aTC8K2a3NN7IvDI0piAjv78rxTleVwko+v95l1eTx9FJn wGhA== X-Received: by 10.68.189.70 with SMTP id gg6mr12688211pbc.123.1379414399967; Tue, 17 Sep 2013 03:39:59 -0700 (PDT) Original-Received: by 10.68.197.34 with HTTP; Tue, 17 Sep 2013 03:39:59 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c03::22c X-Content-Filtered-By: Mailman/MimeDel 2.1.14 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:93410 Archived-At: 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