- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Cut empty lines in a file
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
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
тАО01-29-2002 01:27 AM
тАО01-29-2002 01:27 AM
sar -u 1 10 |awk '{print $2,$3,$4,$5}' |grep -v % |grep -v 9000
which returns me
root@merone:/home/root> sar -u 1 10 |awk '{print $2,$3,$4,$5}' |grep -v % |grep -v 9000
1 0 0 99
0 0 0 100
0 0 1 99
1 0 4 95
0 0 0 100
0 0 0 100
0 0 0 100
0 0 0 100
0 0 0 100
0 0 0 100
0 0 0 99
root@merone:/home/root>
I would like cut the empty lines, to add the other line in a another file.
Thanks to help me, i'm not a developper ! ! !
Solved! Go to Solution.
- Tags:
- awk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-29-2002 01:53 AM
тАО01-29-2002 01:53 AM
Re: Cut empty lines in a file
If you just want to get rid of the empty lines, add another grep:
sar -u 1 10 |awk '{print $2,$3,$4,$5}' |grep -v % |grep -v 9000 | grep -v "^ *$"
or
sar -u 1 10 |awk '{print $2,$3,$4,$5}' |grep -v -e % -e 9000 -e "^ *$"
Hope this is what you mean.
Rgds, Robin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-29-2002 03:19 AM
тАО01-29-2002 03:19 AM
Re: Cut empty lines in a file
Try this:
sar -u 1 10 |awk '{print $2,$3,$4,$5}' |grep -v % |grep -v 9000 > popo
echo "/^$\n1,.-1 w tt1\n.+1,$ w tt2" | ed popo
Regards,
Justo.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-29-2002 03:48 AM
тАО01-29-2002 03:48 AM
Re: Cut empty lines in a file
sar -u 1 10 |awk '{if ($2 -ge 0) print $2,$3,$4,$5}' > yourfile
Ruediger
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-29-2002 04:28 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-29-2002 04:46 AM
тАО01-29-2002 04:46 AM
Re: Cut empty lines in a file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-29-2002 10:20 AM
тАО01-29-2002 10:20 AM
Re: Cut empty lines in a file
^& matches a new-line
^ *& matches a line with zero
or more spaces
What else can be "white space"? For instance,
what about a line with a tab or two? You might
want to upgrade to an extended regular
expression that easily covers more "blank
lines":
^[[:space:]]*&
-dlt-
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-29-2002 07:47 PM
тАО01-29-2002 07:47 PM
Re: Cut empty lines in a file
cat file | /usr/bin/ssp | /usr/bin/rmnl
to remove all blank lines. Works well.
Bill Hassell, sysadmin