Complete.Org: Mailing Lists: Archives: linux-help: January 2002:
[linux-help] Re: multi-line output from Bourne shell

[linux-help] Re: multi-line output from Bourne shell

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: linux-help@xxxxxxxxx
Subject: [linux-help] Re: multi-line output from Bourne shell
From: John Reinke <jmreinke@xxxxxxxxx>
Date: Mon, 7 Jan 2002 22:58:04 -0600
Reply-to: linux-help@xxxxxxxxx

Thanks once again, Tom. I knew that there had to be a simple, elegant 
solution that was just beyond the edge of  my knowledge. I also 
seemed to remember that Perl had gotten the here file feature from 
somewhere else. I didn't know that it would work with any command 
that needs mulitiple lines of input, however. I'm glad you mentioned 
that tidbit.


>John Reinke wrote:
>>  What would be the best way in the Bourne shell (not bash!) to do the
>>  equivelant of Perl's 'print <<END_OF_TEXT;'?
>>  I need to generate a file from a Bourne shell script, and there are
>>  several large portions of the file that will be the same every time. It
>>  wouldn't be feasible to 'echo "one line of text" >> output_file' for every
>>  line in the file. Also, the script probably won't have access to other
>>  files, so appending the contents of separate existing files won't work.
>cat <<EOF
>Type in all the
>text you want, as
>many lines as you want,
>plus you can expand $Variables
>and even run `date`, pretty
>much anything you can do in ""
>except having to escape \",
>until you hit a line with
>nothing but EOF on it
>If you want to pipe this file, add the pipe commands after the <<EOF
>(EOF is convention, anything will do), e.g.:
>cat <<EOF | tr a-z A-Z
>hello world
>goodbye world
>cat just copies stdin to stdout; use any other program that reads stdin
>to whatever effect you're looking for.
>>  Thanks,
>>  John
>  *  Tom Hull * thull at *
>  */
-- This is the linux-help@xxxxxxxxx list.  To unsubscribe,

[Prev in Thread] Current Thread [Next in Thread]