This is kind complex but I have this fixed width txt file. Each line is a new record. For each record, there is a number between bytes 1-4 that will change what is in bytes 10-13
So let's say if I find 0001 then I want to replace bytes 10-13 with the word "hope"
likewise if I find 0002 then I want the word "life"
Make sense? The codes below seems to do something similar, but I don't understand how it works or how I can manipulate it to my situation. My guess is I will have to add an IF statement to read bytes 1-4, compare it to a string, and if it matches, call one of the below commands. Any help would be much appreciated.
echo '123 4567' | sed 's/^\([^ ]* *\)..\(.*\)/\1\2/'
echo '123 4567' | awk '$2=substr($2,3)'