Skip to ContentSkip to Footer
Start of content
- Community Home
- >
- Servers and Operating Systems
- >
- Operating System - Linux
- >
- General
- >
- strange output to file behaviour.
General
-
- Forums
-
- Advancing Life & Work
- Advantage EX
- Alliances
- Around the Storage Block
- HPE Ezmeral: Uncut
- OEM Solutions
- Servers & Systems: The Right Compute
- Tech Insights
- The Cloud Experience Everywhere
- HPE Blog, Austria, Germany & Switzerland
- Blog HPE, France
- HPE Blog, Italy
- HPE Blog, Japan
- HPE Blog, Middle East
- HPE Blog, Latin America
- HPE Blog, Russia
- HPE Blog, Saudi Arabia
- HPE Blog, South Africa
- HPE Blog, UK & Ireland
-
Blogs
- Advancing Life & Work
- Advantage EX
- Alliances
- Around the Storage Block
- HPE Blog, Latin America
- HPE Blog, Middle East
- HPE Blog, Saudi Arabia
- HPE Blog, South Africa
- HPE Blog, UK & Ireland
- HPE Ezmeral: Uncut
- OEM Solutions
- Servers & Systems: The Right Compute
- Tech Insights
- The Cloud Experience Everywhere
-
Information
- Community
- Welcome
- Getting Started
- FAQ
- Ranking Overview
- Rules of Participation
- Tips and Tricks
- Resources
- Announcements
- Email us
- Feedback
- Information Libraries
- Integrated Systems
- Networking
- Servers
- Storage
- Other HPE Sites
- Support Center
- Aruba Airheads Community
- Enterprise.nxt
- HPE Dev Community
- Cloud28+ Community
- Marketplace
-
Forums
-
Blogs
-
Information
-
English
Go to solution
Topic Options
- 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
- Email to a Friend
- Report Inappropriate Content
06-17-2009 04:50 PM
06-17-2009 04:50 PM
Hi All
The following commands work as I expect them to:
free >> free1.out
free | grep "ers/c" >> free2.out
free -s 5 >> free3.out
The last command continually adds to the file.
BUT
This command will not update the output file:
free -s 5 | grep "ers/c" >> free4.out
It displays to the screen ok, but I am unable to redirect it to a file. Why not?
The following commands work as I expect them to:
free >> free1.out
free | grep "ers/c" >> free2.out
free -s 5 >> free3.out
The last command continually adds to the file.
BUT
This command will not update the output file:
free -s 5 | grep "ers/c" >> free4.out
It displays to the screen ok, but I am unable to redirect it to a file. Why not?
Solved! Go to Solution.
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
06-17-2009 08:35 PM
06-17-2009 08:35 PM
Solution
> [...] Why not?
Perhaps because the fancy-shmancy GNU "grep"
is too clever by half:
debi# uname -a
Linux debi 2.6.26-2-mckinley #1 SMP Fri Mar 27 05:13:51 UTC 2009 ia64 GNU/Linux
debi# date ; free -s 5 | grep 'ers/c' | cat ; date
Wed Jun 17 23:29:10 CDT 2009
^C
Wed Jun 17 23:29:25 CDT 2009
debi# date ; free -s 5 | grep --line-buffered 'ers/c' | cat ; date
Wed Jun 17 23:29:46 CDT 2009
-/+ buffers/cache: 184816 16495696
-/+ buffers/cache: 188544 16491968
-/+ buffers/cache: 187040 16493472
^C
Wed Jun 17 23:29:57 CDT 2009
Perhaps because the fancy-shmancy GNU "grep"
is too clever by half:
debi# uname -a
Linux debi 2.6.26-2-mckinley #1 SMP Fri Mar 27 05:13:51 UTC 2009 ia64 GNU/Linux
debi# date ; free -s 5 | grep 'ers/c' | cat ; date
Wed Jun 17 23:29:10 CDT 2009
^C
Wed Jun 17 23:29:25 CDT 2009
debi# date ; free -s 5 | grep --line-buffered 'ers/c' | cat ; date
Wed Jun 17 23:29:46 CDT 2009
-/+ buffers/cache: 184816 16495696
-/+ buffers/cache: 188544 16491968
-/+ buffers/cache: 187040 16493472
^C
Wed Jun 17 23:29:57 CDT 2009
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
06-17-2009 08:36 PM
06-17-2009 08:36 PM
Re: strange output to file behaviour.
> This command will not update the output file:
Check back again tomorrow. (Could be a
pretty big buffer.)
Check back again tomorrow. (Could be a
pretty big buffer.)
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
End of content
United States
Hewlett Packard Enterprise International
Communities
- Communities
- HPE Blogs and Forum
© Copyright 2021 Hewlett Packard Enterprise Development LP