Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^5: Help with fstab

by roboticus (Chancellor)
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.

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?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://948957]
help
Chatterbox?
[thezip]: Heya tye!
[tye]: hey, thezip!
[RonW]: Hi, tye, thezip
[RonW]: I see useless errors liek that from Perl programs, too.
[tye]: well, you certainly don't see strack traces with all of the values removed from Perl.
[thezip]: Howdy RonW. Not in *my* logfiles you won't!
[tye]: and I never claimed anything about 100% on either side.
[RonW]: Presumably because the coders didn't realize that die and warn will append line number and file when the message strings doesn'r end with a line terminator
[tye]: And these are popular and not new python projects.
[thezip]: I had a user complain that they didn't receive an email from one of my processes. I went to the logfile and reproduced the entire contents of the email they would have received. Not my problem.

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (10)
As of 2017-09-21 20:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (252 votes). Check out past polls.

    Notices?