X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org MIME-Version: 1.0 In-Reply-To: <000001ca0fa2$62df2430$289d6c90$@com> References: <000001ca0fa2$62df2430$289d6c90$@com> Date: Wed, 29 Jul 2009 10:11:29 -0400 Message-ID: Subject: Re: AWK from a batch file From: "Mark J. Reed" To: cygwin AT cygwin DOT com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On Tue, Jul 28, 2009 at 12:42 PM, Matthew Swanson wrote: > I am attempting to run AWK in a bash window through a Windows batch file.= =C2=A0I > am using: > > echo awk -v FS=3D',' -v OFS=3D',' '^{ > awk.s > echo =C2=A0 =C2=A0if ^($2 ~ /^^[0-9]*$/^)>> awk.s > echo =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0print $0 ^>^> "good_file.tx= t">> awk.s > echo =C2=A0 =C2=A0else>> awk.s > echo =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0print $0 ^>^> "bad_file.txt= ">> awk.s > echo ^}' input_file.txt>> awk.s OK, so you are creating a bash script from CMD. Invoking it outside of Cygwin means the normal bash startup files are not run, so $PATH is not set, so it can't find any commands. Replace "awk" with "/bin/awk" and you should be good, apart from the lack of execute permission. The second problem is that CMD's "echo" appends carraige returns. Add these commands to fix both that problem and the execute permission one: \cygwin\bin\d2u awk.s \cygwin\bin\chmod +x awk.s --=20 Mark J. Reed -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple