the following syntax target is to add “_name4” on the first string in line that match the “name1 + name2 + name3” and to replace old word with new
cat file | sed '/name1 + name2 + name3/s/[^ ]*\>/&_name4/' | sed s'/old/new/g' > new_file
my question : is it possible to do the same without using cat command?
You rarely need cat. You could do it like this:
You can also combine the sed commands: