Code: Select all
random text PARTUUID=a5d5af73-01 random textCan anyone help or give me an alternative method?
-JohnK
Code: Select all
random text PARTUUID=a5d5af73-01 random textThis should change PARTUUID=... (including all characters from the = up to the first space) into /dev/mmcblk0p1 in the file filename, and backs up the original to filename.bak If you don't want the original file backing up don't pass a string to --in-place. And if you don't want to actually alter the file don't pass --in-place, then the output is sent to stdout rather than rewriting the file.JMK8 wrote:I have a relatively straight-forward task to do in a bash script using sed. I'm not familiar with bash scripting and even less so with sed. I have a text file like this:
Obviously I have no control over the hex number. What I want to do is substitute PARTUUID=a5d5af73-01 with /dev/mmcblk0p1 I have gone around in circles trying to do this with sed but no joy -maybe I'm too thick to get my head around itCode: Select all
random text PARTUUID=a5d5af73-01 random text![]()
Can anyone help or give me an alternative method?
-JohnK
Code: Select all
sed --in-place=".bak" "s,PARTUUID=[^ ]*,/dev/mmcblk0p1," filenameCode: Select all
sed --in-place=".bak" "s,PARTUUID=[^ \t]*,/dev/mmcblk0p1,g" filenameWhy? PARTUUID works and is agnostic to the device you're booting. That's why it's in Raspbian Jessie so that the same image works on an SDCard or a bootable USB device (on RPi3).JMK8 wrote:. What I want to do is substitute PARTUUID=a5d5af73-01 with /dev/mmcblk0p1 I have gone around in circles trying to do this with sed but no joy -maybe I'm too thick to get my head around it![]()