http://www.perlmonks.org?node_id=948957


in reply to Re^4: Help with fstab
in thread Help with fstab

Dorficus:

If I recall correctly, /etc/fstab uses whitespace to delimit the fields, so you should be able to do something like:

open FILE, '<', "/mnt/etc/fstab"; my @lines = <FILE>; for (@lines) { my @fields = split /\s+/, $_; print "First column: $fields[0], Third column: $fields[2].\n"; }

...roboticus

When your only tool is a hammer, all problems look like your thumb.

Replies are listed 'Best First'.
Re^6: Help with fstab
by Dorficus (Initiate) on Jan 20, 2012 at 13:18 UTC

    This really helped, it got rid of a lot of unnessecary information, but do you have any clue on how to do it vertical as well?

        I know I'm asking a lot but I also would like to know how I only get the lines that start with a "/", is that possible?