Article View: comp.unix.shell
Article #1749Re: How do you pipe after a here document
From: David W. Tamkin
Date: Sat, 10 Nov 1990 05:50
Date: Sat, 10 Nov 1990 05:50
42 lines
1356 bytes
1356 bytes
afsipmh@cidsv01.cid.aes.doe.CA (Pat Hertel) wrote in
<1990Nov8.201508.13222@cid.aes.doe.CA>:
| I want to do something like the following:
|
| #! /bin/sh
| cat <<END
| I,ve got
| a lovely
| bunch of coconuts
| END
| | grep coconuts
|
| The above doesn't work so how can I do it?
Two other people have suggested
cat << END | grep coconuts
I've got
a lovely
bunch of coconuts
END
That works in sh, and so does this:
{ cat << END
I've got
a lovely
bunch of coconuts
END # or END ;} | grep coconuts
} | grep coconuts #
and, believe it or not, so does this:
grep coconuts << END
I've got
a lovely
bunch of coconuts
END
David Tamkin Box 7002 Des Plaines IL 60018-7002 708 518 6769 312 693 0591
MCI Mail: 426-1818 GEnie: D.W.TAMKIN CIS: 73720,1570 dattier@ddsw1.mcs.com
Technical Details
Message-ID:
<1990Nov10.055023.7851@ddsw1.MCS.COM>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!mcdchg!ddsw1!dattierReferences:
<1990Nov8.201508.13222@cid.aes.doe.CA>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!mcdchg!ddsw1!dattier From: dattier@ddsw1.MCS.COM (David W. Tamkin) Newsgroups: comp.unix.shell Subject: Re: How do you pipe after a here document Summary: ... or ... Message-ID: <1990Nov10.055023.7851@ddsw1.MCS.COM> Date: 10 Nov 90 05:50:23 GMT References: <1990Nov8.201508.13222@cid.aes.doe.CA> Reply-To: dattier@ddsw1.MCS.COM (David W. Tamkin) Distribution: na Organization: Contributor Account at ddsw1, Wheeling, Illinois Lines: 42