I have strings in a text file with certain formats. I want to replace the word part of the string but keep the numeric identifier. For example, I have strings like L2_name1
, L12_name6
but many of the names have similar identifiers: name1 = JohnMSmith, name6 = JohnMSmithinson.
I would like to use something like sed 's/L2_name1/L2_new_name/g' file.csv
but using regex so something like
sed -E 's/L[0-9]{1,2}_name1/{same leading monicker found in the matching part}_new_name/g' file.csv