I’m new to Perl and I really need help witch a specific issue.
I need to extract info from my fstab, but there’s a lot of information in there and I only want the information about the devices and their mount points.
The closest I got to finding an answer was:
http://www.freebsd.org/doc/en/articles/vinum/perl.html
But since I’m new to Perl I have a hard time tweaking the code so it helps me with my problem
This is my fstab, but I only want the 3 “dev” lines including mountpoints, any smart way to do this?
/dev/disk/by-id/usb-ST925041_0AS_FF9250410A0000000000005FF87FF7-part2 /
ext3 noatime,nodiratime,acl,user_xattr 1 1
/dev/disk/by-id/usb-ST925041_0AS_FF9250410A0000000000005FF87FF7-part3 /var/log
ext3 noatime,nodiratime,acl,user_xattr 1 2
/dev/disk/by-id/usb-ST925041_0AS_FF9250410A0000000000005FF87FF7-part1 swap swap
defaults 0 0
proc /proc proc defaults 0 0
sysfs /sys sysfs noauto 0 0
debugfs /sys/kernel/debug debugfs noauto 0 0
usbfs /proc/bus/usb usbfs noauto 0 0
devpts /dev/pts devpts mode=0620,gid=5 0 0
Help is very appreciated, thanks in advance!
If that is your output, and you just want to grab the lines that start with
/dev, you can simply pipe it to grep, without altering your perl script.Not sure if that works without the
-eflag, its been a while and I can’t test it right now. If all else fails, use perl: