Trouble passing args, & where is 'more'

Eric Engberg
Thu Sep 24 19:59:00 GMT 1998


I took some text-hacking code written on Unix that uses things like sed, awk, and perl, and I can't seem to get some of the simple scripts that use command line arguments to work.

I am also looking for a tool like 'more' so stdout doesn't fly by if its more than 1 page.

I'm also wondering how to 'alias' commands, and how to accomplish 'foreach' commands.  

Basically, I miss Unix.  

Below is an example of a script that doesn't work on NT (with cygwin32, and correctly telling it to use bash as the shell), but worked fine on Unix.

Any help would be much appreciated.


# lst2xlt
# General sed script to tab-delimit SAS output (for import to Excel)
# USAGE:  % lst2xlt sasoutfile1.lst [ sasoutfile2.lst ... ]
# 1. strips whitespace up to first non-white char of line
# 2. strips whitespace after last  non-white char of line
# 3. removes page breaks
# 4. removes SAS table border characters: {-,|,+}
# 5. replaces 2 or more spaces with a single tab for parsing into cells
# EXAMPLES:  % lst2xlt pprint.lst  -- converts single file to pprint.xlt
#            % lst2xlt *.lst       -- generates .xlt file for each .lst in dir
# NOTE: will *not* use any file that doesn't end in .lst, and does
#       not alter existing .lst input file
# ABF  Tue Dec 05 1995

foreach sasfile ($*)
  if (${sasfile:e} =~ 'lst') then
    sed 's/^ *//\
         s/ *$//\
         s/|/  /g\
         /^[-+ ]\{3,\}$/d\
         s/ \{2,\}/	/g' $sasfile >! ${sasfile:r}.xlt
    echo ${0}: Ignoring $sasfile

Free e-mail group hosting at
For help on using this list (especially unsubscribing), send a message to
"" with one line of text: "help".

More information about the Cygwin mailing list