Mar 26, 2004 #1 TheDash MIS Joined Mar 25, 2004 Messages 171 Location US Hi, Can we skip first line during processing? for example: the first line shows header info. Ex: bdf -i | awk {'print $5'} gives %used where as it should start with next line so that it will give 11% ... Thanks
Hi, Can we skip first line during processing? for example: the first line shows header info. Ex: bdf -i | awk {'print $5'} gives %used where as it should start with next line so that it will give 11% ... Thanks
Mar 26, 2004 #2 vgersh99 Programmer Joined Jul 27, 2000 Messages 2,146 Location US bdf -i | awk 'NF > 1 {print $5}' vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+ Upvote 0 Downvote
bdf -i | awk 'NF > 1 {print $5}' vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+
Mar 26, 2004 #3 vgersh99 Programmer Joined Jul 27, 2000 Messages 2,146 Location US ooops, sorry: bdf -i | awk 'FNR > 1 {print $5}' vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+ Upvote 0 Downvote
ooops, sorry: bdf -i | awk 'FNR > 1 {print $5}' vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+
Mar 26, 2004 #4 johngiggs Technical User Joined Oct 30, 2002 Messages 492 Location US TheDash, Try using: bdf | awk '!/^[A-z]/{print $5}' John Upvote 0 Downvote
Mar 26, 2004 Thread starter #5 TheDash MIS Joined Mar 25, 2004 Messages 171 Location US Thanks all for the immediate help. I also need to trim down 11% to 11? Can somebody please tell how I can substring $var? Unfortunately, I don't see substr help anywhere. Upvote 0 Downvote
Thanks all for the immediate help. I also need to trim down 11% to 11? Can somebody please tell how I can substring $var? Unfortunately, I don't see substr help anywhere.
Mar 26, 2004 #6 PHV MIS Joined Nov 8, 2002 Messages 53,708 Location FR Have you tried this ? bdf -i | awk 'FNR > 1 {sub(/%/,"",$5);print $5}' Hope This Help, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 Upvote 0 Downvote
Have you tried this ? bdf -i | awk 'FNR > 1 {sub(/%/,"",$5);print $5}' Hope This Help, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
Mar 26, 2004 #7 vgersh99 Programmer Joined Jul 27, 2000 Messages 2,146 Location US bdf -i | awk 'FNR > 1 {print $5+0}' vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+ Upvote 0 Downvote
bdf -i | awk 'FNR > 1 {print $5+0}' vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+