get rid of unwanted lines

Hi ,

My output contains the below contents

When i execute

 
df -h | grep / | grep -v '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }'

i get output as below

 
tpshghghg.fgh.com:/vol/scmvol1/scm-vobstore/WebArch.vbs
                      1.7T  1.3T  452G  74% /vob/WebArch
tpshghghg.fgh.com:/vol/scmvol1/scm-vobstore/Analyst_Metrics.vbs
                      1.7T  1.3T  452G  74% /vob/Analyst_Metrics
tpshghghg.fgh.com:/vol/scmvol1/scm-vobstore/Analyst_Metrics_Admin.vbs
                      1.7T  1.3T  452G  74% /vob/Analyst_Metrics_Admin
tpshghghg.fgh.com:/vol/scmvol1/scm-vobstore/ioscomp_tot.vbs
                      1.7T  1.3T  452G  74% /vob/ioscomp_tot
tpshghghg.fgh.com:/vol/scmvol1/scm-vobstore/vob_etl_framework.vbs
                      1.7T  1.3T  452G  74% /vob_etl_framework
tpshghghg.fgh.com:/vol/scmvol1/scm-vobstore/vob_pdsweb.vbs
                      1.7T  1.3T  452G  74% /vob_pdsweb
tpshghghg.fgh.com:/vol/scmvol1/scm-vobstore/vob_nz_tick.vbs
                      1.7T  1.3T  452G  74% /vob_nz_tick
tpshghghg.fgh.com:/vol/scmvol1/scm-vobstore/vob_rdrcore.vbs
                      1.7T  1.3T  452G  74% /vob_rdrcore
tpshghghg.fgh.com:/vol/scmvol1/scm-vobstore/vob_sts_dashboard.vbs
                      1.7T  1.3T  452G  74% /vob_sts_dashboard
ghghg.fgh.com:/vol/scmvol1/fi-vobstore/vob_ewsmatlab.vbs
                      335G  259G   77G  78% /vob_ewsmatlab
ghghg.fgh.com:/vol/scmvol1/fi-vobstore/vob_fabricserver.vbs
                      335G  259G   77G  78% /vob_fabricserver
tpshghghg.fgh.com:/vol/scmvol1/scm-vobstore/vob_arrow2.vbs

now I would need to get rid of all the unnecessary lines like

ghghg.fgh.com:/vol/scmvol1/fi-vobstore/vob_ewsmatlab.vbs

tpshghghg.fgh.com:/vol/scmvol1/scm-vobstore/vob_sts_dashboard.vbs

any help on this pls.

awk 'NF>1' filename

output is

                      1.7T  1.3T  452G  74% /vob/WebArch
                      1.7T  1.3T  452G  74% /vob/Analyst_Metrics
                      1.7T  1.3T  452G  74% /vob/Analyst_Metrics_Admin
                      1.7T  1.3T  452G  74% /vob/ioscomp_tot
                      1.7T  1.3T  452G  74% /vob_etl_framework
                      1.7T  1.3T  452G  74% /vob_pdsweb
                      1.7T  1.3T  452G  74% /vob_nz_tick
                      1.7T  1.3T  452G  74% /vob_rdrcore
                      1.7T  1.3T  452G  74% /vob_sts_dashboard
                      335G  259G   77G  78% /vob_ewsmatlab
                      335G  259G   77G  78% /vob_fabricserver

Two piped grep commands is a resource waste. awk can filter on content. Give us a typical output of your dh command.

You might want to consider using the "-t" switch of df instead of grepping unwanted results afterwards. For instance:

df -h -t ext3 -t ext4

lists only the filesystems of type ext3 or ext4.

The switch "-P" will switch to a one-line-per-FS output format, which will probably easier to process too.

I hope this helps.

bakunin

HI Thanks for the reply and it worked fine .
Would like to understand what it means actually that waht it did.

 
awk 'NF>1'

Print the line if the number of fields > 1.

hi my df -h is giving very much scrambled data .please see below .I dont want this kind of output .please advsie what can be done .

48% /
66M 30%
8.0G 0%
20% /opt
3% /tmp
86% /var
1% /var/crash
0% /fistrd01/fi/str/dv
16% /fmwrpd01/wrp
18% /usr/local/ifeeds
48% /view
86% /vobs/fi_etrading
86% /vobs/FI_EUD
86% /vobs/fi_pot
86% /vobs/fi_shared
86% /vobs/functors
86% /vobs/mm
86% /vobs/OnePoint
86% /vobs/pa
86% /vobs/play
86% /vobs/pnav
86% /vobs/qfw
86% /vobs/quant
86% /vobs/separate_accounts
86% /vobs/tools
86% /vobs/ude
86% /vobs/WebPOT
86% /vobs/Blob
86% /vobs/Repo
86% /vobs/Mist
86% /vobs/IssuerAppEditor
86% /vobs/CR_Approvals
86% /vobs/CR_SecurityDetail
86% /vobs/CR_Shared
86% /vobs/msigen
86% /vobs/ContentMgmt
86% /vobs/AMR
86% /vobs/fis_test
86% /vobs/SVQuery
86% /vobs/fis_release
86% /vobs/fi_basis_eda
86% /vobs/creditResearch
86% /vobs/IssuerWorkSpace
86% /vobs/FIDE
86% /vobs/fi_release
86% /vobs/fi_pot_eda
86% /vobs/FXTrading_arch2
86% /vob_fi_eda
86% /vob_fi_ead
86% /vob_fide_tst
86% /vob_ResearchPrint
86% /vob_quant_analysis
86% /vob_vinay_test
86% /vob_cbs
 

so /vob is repeatd so many times.but i want to only /vob.please advise