- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- "tee" command
Categories
Company
Local Language
Forums
Discussions
Knowledge Base
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2001 06:19 AM
12-13-2001 06:19 AM
"tee" command
Take a look at this code:
-----------------------------------------------------------------------------
dev03:/ # ping yellow -n 2 | tee /tmp/1 | grep time
64 bytes from 172.16.19.17: icmp_seq=0. time=3. ms
64 bytes from 172.16.19.17: icmp_seq=1. time=1. ms
dev03:/ # cat /tmp/1
PING yellow.wc.ricoh.com: 64 byte packets
64 bytes from 172.16.19.17: icmp_seq=0. time=3. ms
64 bytes from 172.16.19.17: icmp_seq=1. time=1. ms
----yellow.wc.ricoh.com PING Statistics----
2 packets transmitted, 2 packets received, 0% packet loss
round-trip (ms) min/avg/max = 1/2/3
------------------------------------------------------------------------------
Every thing is the way it should be!
But now take a look at the same code where grep is with option "-q":
------------------------------------------------------------------------------
dev03: # ping yellow -n 2 | tee /tmp/1 | grep -q time
dev03: # cat /tmp/1
PING yellow.wc.ricoh.com: 64 byte packets
64 bytes from 172.16.19.17: icmp_seq=0. time=8. ms
------------------------------------------------------------------------------
Why the output of "cat /tmp/1" is different?
Thanks,
Troy.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2001 06:26 AM
12-13-2001 06:26 AM
Re: "tee" command
ping node -n 2 | grep -q time | tee /tmp/1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2001 06:50 AM
12-13-2001 06:50 AM
Re: "tee" command
You command works fine on Solaris. It looks like an HP issue. For now, you'll have to:
ping yellow -n 2 > /tmp/1
grep -q time /tmp/1
Interestingly, this works too:
ping yellow -n 2 | tee /tmp/1 | tee /tmp/1 | grep -q time
Jeff, if you do it that way round, /tmp/1 will be empty.
Rgds, Robin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2001 06:55 AM
12-13-2001 06:55 AM
Re: "tee" command
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2001 06:58 AM
12-13-2001 06:58 AM
Re: "tee" command
I do not want to put "tee" at the end. I expected /tmp/1 from second code to be the same as from the first code. I friend of mine just resolved the issue. "grep -q" interrupt the process as soon as it find the first matching line.
Thank you Rumiana Boiajieva,
Troy.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2001 07:04 AM
12-13-2001 07:04 AM
Re: "tee" command
Jeff, grep -q means 'quiet'. quiet means no output. You will tee nothing so the file will be empty.
grep -q exits with return 0 when the first match is found. This is suppose messes the 'ping' command.
on the computer named, let's say host1 I used
ping host2 -n 5 | tee file | grep -q time
and on host 2 I was doing a tcpdump ip src host1
guess what? only 2 icmp requests arrived at host2.
This means that grep returns 0 on the first occurence so the ping is stopped but first it sends the second request.
I will dig a bit deeper, it seems normal behaviour to me, but I don't understand exactly what 'normal' means.
E.