Subject: Trouble passing args, & where is 'more'
From: [email-masked] (Eric Engberg)

25 Sep 1998 04:19:18 -0700
Message-ID: <[email-masked]>
To: [email-masked]

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

[email-masked]

#!/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
"[email-masked]" with one line of text: "help".