Created
December 24, 2015 19:08
-
-
Save jdoss/08e5153a6edf15db0e98 to your computer and use it in GitHub Desktop.
An attempt to use AWK to find and replace $1 based on line number.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
awk '{ if (NR==1) {getroot = "blkid -s UUID /dev/fedora_server/root|cut -d: -f2"} {getroot |& getline root } {$1=root} \ | |
if (NR==2) {close("getroot")}{getboot = "blkid -s UUID /dev/mmcblk0p1|cut -d: -f2"} {getboot |& getline boot} {$1=boot} {close("getboot")} \ | |
if (NR==3) {close("getboot")}{getswap = "blkid -s UUID /dev/mmcblk0p2|cut -d: -f2"} {getswap |& getline swap} {$1=swap} } {close("getswap")}1' etc/fstab | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment