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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

would like to view different between two commands 2

Status
Not open for further replies.

peac3

Technical User
Jan 17, 2009
226
AU
Hi guys,

I was trying to diff between 2 output commands "netstat -ar" and route?

At the moment I used 2 lines
netstat -ar > temp1 && route >temp2
then
diff temp1 temp2
rm temp1 temp2

Is there any one liner to produce this?

Those commands is only one of example and I have many things to compare basically.

Thanks in advance,
 
You can use something called "Process Substitution" which I find very useful... but unfortunately it's not available on many combinations of shells and/or operating systems.

Code:
$ diff <(netstat -r) <(route)

Otherwise, diff can also use stdin as a source by specifying - as one of the input filenames, so that would cut out at least one step:

Code:
netstat -rn > temp1
route | diff - temp1
rm temp1


Annihilannic.
 
Process subs is working..
Hopefully its working with other command as well..

Thanks Anni.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top