sed 's/^([^ ]+ +)([^ ]+)/\1HELL/'
Hello,simple task. I want to change the 2nd field on each line of a file, but preserve the spacing of the lines. If I do awk '{$2="hell"; print}' file the field gets changed, but all the spacing of the lines is gone; i.e. any space is now just ' ' like this: 1 3 4 8 changes to 1 hell 4 8 while I need 1 hell 4 8. Any help? Thanks Ruda