Cut question

Ralph W. Reid rreid at sunset.net
Tue Sep 16 02:48:19 EDT 2003


Mike Keithley staggered into view and mumbled:
>
>Hi list
>
>I am trying to write a command to return free disk space so I can use it
>in a script.  My most recent attempt is
>
>df `pwd` | grep "/" | cut -f4
>
>Now this returns the entire line from df like:
>
>/dev/sdb2              8609476   3522184   4999820  42% /
>
>What delimiter in cut do I need to pick off field 4?

Have you considered using `awk' instead?  The following may do what
you want:

df . | tail -1 | awk '{print $4}'

I hope this helps.  Have a _great_ day!

-- 
Ralph.  N6BNO.  Wisdom comes from central processing, not from I/O.
rreid at sunset.net  http://personalweb.sunset.net/~rreid
Opinions herein are either mine or they are flame bait.
TAN (x) = SIN (x) / COS (x)




More information about the Speakup mailing list