X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-0.7 required=5.0 tests=BAYES_20 X-Spam-Check-By: sourceware.org From: "Matthew Swanson" To: Subject: AWK from a batch file Date: Tue, 28 Jul 2009 11:42:19 -0500 Message-ID: <000001ca0fa2$62df2430$289d6c90$@com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: 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 I am attempting to run AWK in a bash window through a Windows batch file. I am using: echo awk -v FS=',' -v OFS=',' '^{ > awk.s echo if ^($2 ~ /^^[0-9]*$/^)>> awk.s echo print $0 ^>^> "good_file.txt">> awk.s echo else>> awk.s echo print $0 ^>^> "bad_file.txt">> awk.s echo ^}' input_file.txt>> awk.s I am having two problems: 1. I cannot get awk.s to run successfully. If I call it directly after associating .s files with bash, it says awk: command not found. I get a similar error if I call "c:\cygwin\bin\bash.exe -c ./awk.s" How should I be executing awk.s from my batch file? I found a couple postings, but they all refer to interpreters in c:\cygwin\bin which aren't present. 2. This may be a question for another forum, but I thought I would include it here, too, in hopes of getting an answer. The script, awk.s, that is created in my batch file, when run directly in cygwin, displays " ' for reading (No such file or directory) 'input_file.txt" If you manually edit awk.s and remove the trailing carriage return, it executes successfully. How can I get the batch file to not include a trailing carriage return at the end of the file? Thanks for any help or suggestions! -- 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