1. awk
Need to print the ufs filesystem listed in /etc/vfstab file
awk '($4 == "ufs") | printf("%s %s\n", $1, $3) }' /etc/vfstab
The above command will print filesystems which are commented as well. To print only the active filesystem, use the following commands
awk '(!/^#/ && $4 == "ufs") { printf("%s %s\n", $1, $3) }' /etc/vfstab
!/^#/ - ignore all the commented lines $4 - is the fourth column in the /etc/vfstab file
Need to print the ufs filesystem listed in /etc/vfstab file
awk '($4 == "ufs") | printf("%s %s\n", $1, $3) }' /etc/vfstab
The above command will print filesystems which are commented as well. To print only the active filesystem, use the following commands
awk '(!/^#/ && $4 == "ufs") { printf("%s %s\n", $1, $3) }' /etc/vfstab
!/^#/ - ignore all the commented lines $4 - is the fourth column in the /etc/vfstab file
No comments:
Post a Comment