Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^5: Help with fstab

by roboticus (Canon)
on Jan 20, 2012 at 13:07 UTC ( #948957=note: print w/ replies, xml ) Need Help??


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.


Comment on Re^5: Help with fstab
Download Code
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?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://948957]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2014-10-01 23:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (41 votes), past polls