Feb 4, 2004 #1 helo222 MIS Feb 4, 2004 1 TW I will monitor my HD.The scripe as blow. #df -k|grep notes|awk '{printf "%s\n",$5} #43% Which command can help me to get number 43 not 43%? Thank you.
I will monitor my HD.The scripe as blow. #df -k|grep notes|awk '{printf "%s\n",$5} #43% Which command can help me to get number 43 not 43%? Thank you.
Feb 4, 2004 #2 bonifale Programmer Sep 4, 2003 74 GB Check out man page for 'cut' I don't have a unix box here so working from memory.... set the percent symbol as the delimiter #df -k|grep notes|awk '{printf "%s\n",$5} | cut -d'%' -f1 alternatively if you know the number will always be 2 characters long. #df -k|grep notes|awk '{printf "%s\n",$5} | cut -c1-2 hope this helps Upvote 0 Downvote
Check out man page for 'cut' I don't have a unix box here so working from memory.... set the percent symbol as the delimiter #df -k|grep notes|awk '{printf "%s\n",$5} | cut -d'%' -f1 alternatively if you know the number will always be 2 characters long. #df -k|grep notes|awk '{printf "%s\n",$5} | cut -c1-2 hope this helps
Mar 2, 2004 #3 sachinss1978 MIS Sep 28, 2002 20 IN bonifale's reply for question works for the queries , it displays correct output Upvote 0 Downvote
Mar 2, 2004 #4 Chacalinc Vendor Sep 2, 2003 2,043 US it works for monitoring disk space: Code: df -k | grep ^/| sed 's/\%//g' | awk ' {print $5}' Upvote 0 Downvote
Mar 2, 2004 #5 Chacalinc Vendor Sep 2, 2003 2,043 US oh.. previous post will give you all filesystems, for "notes" issue: df -k | grep notes | sed 's/\%//g' | awk ' {print $5}' sed statment will erase the '%' character. Upvote 0 Downvote
oh.. previous post will give you all filesystems, for "notes" issue: df -k | grep notes | sed 's/\%//g' | awk ' {print $5}' sed statment will erase the '%' character.