Trouble passing args, & where is 'more'

Eric Engberg eric.engberg@nextcard.com
Thu Sep 24 19:59:00 GMT 1998


Hey,

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.

-Eric

Eric.Engberg@nextcard.com

#!/bin/csh
#
# 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/
  *//g\
         s/ \{2,\}/	/g' $sasfile >! ${sasfile:r}.xlt
  else
    echo ${0}: Ignoring $sasfile
  endif
end


-----
Free e-mail group hosting at http://www.eGroups.com/
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".



More information about the Cygwin mailing list