Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Standard Input/Standard Output

Status
Not open for further replies.

reason1000

IS-IT--Management
Feb 1, 2002
38
US
Hello,

Is there a way to direct standard output of once command to standard input of a command on the command line?

Example:

Two programs:
program1.pl
program2.pl

program1.pl accepts STDIN, which will be a list generated by
program2.pl. I thought I could run something like below to generate the list with program2.pl and direct that to STDIN of program1.pl so it can process the list.

program1.pl < program2.pl | sort -n | uniq

Are the pipes a problem?

I know there are other ways to do this type of thing but I just got stuck on this and I'm wondering if it's even possible to do.

Thanks!
 
I ended up just switching the order the scripts were run on the command line and that works.

program2.pl | sort -n | uniq | program1.pl

I guess I'm still wondering if it's possible to do it in a similar way to what I had in the original posting.

I'm taking a course in Perl in a couple of weeks. I'm looking forward to learning more so I don't get stuck on silly things like this. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top