sed/csh interaction
Paul Gerwitz
gerwitz at hpcore.kodak.com
Thu Aug 9 04:46:40 AEST 1990
Here is an interesting phenomena for you u**x hackers. Below are two
variations of the same script which takes a news article and strips out the
subject line for use later. The second variation was created because the
csh on a different machine would not take the origonal script. The
question is "why won't this one script work on both machines.
File 1
Origonal script
works on Decstation 3100 @ Ultrix 3.0
DOES NOT WORK on HP835 at HP-UX 7.0
#!/bin/csh -f
# Command to print stdin with a Subject: line
set title=`tee temporary | sed -e '/^Subject: /\\!d\\\
s/Subject: //'`
echo $title
-------------------------------------------------------
File 2
Modified origonal
Works on HP-UX
DOES NOT WORK on Ultrix
#!/bin/csh -f
set title="`tee temporary | sed -e '/^Subject: /\\!d \\
s/Subject: //'`"
echo $title
The script is run as such: file1 < testdata
Here is the test data file:
>From eastman!kodak!rochester!cornell!mailrus!cs.utexas.edu!uunet!pilchuck!ssc!tad Tue Aug 7 08:17:53 1990
Article 12754 of rec.ham-radio:
Path: eastman!kodak!rochester!cornell!mailrus!cs.utexas.edu!uunet!pilchuck!ssc!tad
>From: tad at ssc.UUCP (Tad Cook)
Newsgroups: rec.ham-radio
Subject: AMSAT News, 8/4/90
Keywords: Ham satellite news
Message-ID: <971 at ssc.UUCP>
Date: 6 Aug 90 05:29:45 GMT
Organization: very little
Lines: 682
--
+----------------------------------------------------------------------------+
| Paul F Gerwitz WA2WPI | SMTP: gerwitz at kodak.com |
| Eastman Kodak Co | UUCP: ..uunet!atexnet!kodak!eastman!gerwitz |
+----------------------------------------------------------------------------+
More information about the Comp.unix.questions
mailing list