awk question, maybe

Roman Neuhauser neuhauser at bellavista.cz
Fri Dec 19 04:13:18 PST 2003


# David.Bear at asu.edu / 2003-12-15 16:30:33 -0700:
> i would like to do something like
> 
> df | awk '{print $1}'
> 
> to capture all the current file systems.  But I would like to strip
> off the first and last lines, since these are generally -- not needed.
> 
> the goal is to write a generalized script that can feed dump with all
> the file systems on a box.

    I would use mount(8) instead: its output doesn't include any
    headers, but you'll still want to pass through only local
    filesystems, so it doesn't really matter:

    roman at freepuppy ~ 1006:0 > mount | awk '/\/dev\/(ad|da)/ {print $1}' 
    /dev/ad0s1a
    /dev/ad0s1e
    roman at freepuppy ~ 1007:0 > df | awk '/\/dev\/(ad|da)/ {print $1}'   
    /dev/ad0s1a
    /dev/ad0s1e

-- 
If you cc me or remove the list(s) completely I'll most likely ignore
your message.    see http://www.eyrie.org./~eagle/faqs/questions.html


More information about the freebsd-questions mailing list