|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
HI , i have to print the first header of df -h (Filesystem Size Used Avail Use% Mounted on)and line which conatin size Network path only. Code:
Filesystem Size Used Avail Use% Mounted on
/test/sda3 35G 1.8G 32G 6% /
/test/sda10 7.8G 1.1G 6.3G 15% /usr
/test/sda12 3.9G 73M 3.7G 2% /usr/local
/test/sda9 7.8G 329M 7.1G 5% /var
/test/sda8 7.8G 3.6G 3.9G 49% /opt
/test/sda7 16G 1.4G 14G 10% /tmp
4.0T 523G 3.5T 13% /Network/Test |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
Code:
$ sed -n '1p; /Network/p' file
Filesystem Size Used Avail Use% Mounted on
4.0T 523G 3.5T 13% /Network/Test
$ awk 'NR==1 || /Network/' file
Filesystem Size Used Avail Use% Mounted on
4.0T 523G 3.5T 13% /Network/Test |
| The Following User Says Thank You to RudiC For This Useful Post: | ||
netdbaind (02-15-2013) | ||
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
As described in
man df , you can have the desired item (device path or mount path) as extra argument: Code:
df -h /Network/Test |
|
#4
|
|||
|
|||
|
You can also try this. Code:
df -h | grep -w 'Filesystem\|Network' |
| Sponsored Links | ||
|
![]() |
| Tags |
| awk |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| awk print header as text from separate file with getline | sdf | Shell Programming and Scripting | 4 | 12-14-2011 05:24 PM |
| Need awk help to print specific columns with as string in a header | arv_cds | Shell Programming and Scripting | 21 | 05-27-2011 11:31 AM |
| print lines AFTER lines cointaining a regexp (or print every first and fourth line) | kmkocot | Shell Programming and Scripting | 1 | 07-06-2010 09:57 PM |
| print lines except the header | madfox | Shell Programming and Scripting | 2 | 01-21-2010 08:41 AM |
| Strip 3 header lines and 4 trailer lines | ganesh123 | Shell Programming and Scripting | 9 | 03-10-2007 04:15 PM |
|
|