Networking Forums

Networking Forums > Computer Networking > Linux Networking > piping a group of lines to a program

Reply
Thread Tools Display Modes

piping a group of lines to a program

 
 
rhXX
Guest
Posts: n/a

 
      05-30-2007, 11:39 AM
hi all,

i want to send a group of lines to a program in a script shell.

now i'm using:

echo "line 1" > $TMPFILE
echo "line 2" >> $TMPFILE
....
echo "line N" >> $TMPFILE

cat $TMPFILE | prog

rm -f $TMPFILE

it seems me very primitive, create / delete a temp file only to
"group" the lines for piping

is it any method to pipe these line directly without temp file?

tks in advance

 
Reply With Quote
 
 
 
 
Davide Bianchi
Guest
Posts: n/a

 
      05-30-2007, 11:59 AM
On 2007-05-30, rhXX <(E-Mail Removed)> wrote:
> i want to send a group of lines to a program in a script shell.
>
> it seems me very primitive, create / delete a temp file only to
> "group" the lines for piping


try with:

prog <<EOF
line 1
line 2
line 3
EOF

Davide

--
Driving is a video game, with only one life but many cars.
- from a letter on The Register
 
Reply With Quote
 
Douglas O'Neal
Guest
Posts: n/a

 
      05-30-2007, 12:14 PM
rhXX wrote:
> hi all,
>
> i want to send a group of lines to a program in a script shell.
>
> now i'm using:
>
> echo "line 1" > $TMPFILE
> echo "line 2" >> $TMPFILE
> ...
> echo "line N" >> $TMPFILE
>
> cat $TMPFILE | prog
>
> rm -f $TMPFILE
>
> it seems me very primitive, create / delete a temp file only to
> "group" the lines for piping
>
> is it any method to pipe these line directly without temp file?
>
> tks in advance


(echo "line 1"; echo "line 2"; ... ; echo "line N") | prog
 
Reply With Quote
 
rhXX
Guest
Posts: n/a

 
      05-30-2007, 12:33 PM
ok, tks to all for inmediatly help!

sincerely

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Piping audio stream Christian Christmann Linux Networking 0 10-17-2006 08:40 AM
Program Scheduler to start and end a program? Kevin Wooloff Home Networking 1 09-05-2006 04:10 PM
piping output - line breaks?? linuxnooby Linux Networking 3 04-04-2005 03:33 AM
piping over ftp Ivan Kelly Linux Networking 1 07-14-2004 03:02 AM
Adding global group to Local group =?Utf-8?B?TWFyayBMYXdyZW5jZQ==?= Windows Networking 0 05-18-2004 04:06 AM



1 2 3 4 5 6 7 8 9 10 11