Artificial intelligent assistant

replace two separate words in a matched string sed Consider the following input string. PLOG_NFET_SLVT nf=3 ng=1 nl=20n Output PLOG_NFET_LVT nf=3 ng=1 nl=14n Note: 1st and last word are replaced. Also in between data varies. So I can not have a constant pattern. I tried using below command. sed -i 's/PLOG.*FET_SLVT.*nl=20n/PLOG.*FET_LVT.*nl=14n/g' file and output is : PLOG.*FET_LVT.*nl=14n Any help?

You can use a capture group in the search pattern and add the backreference (`\1` or `\2`) to the replace pattern:


sed 's/PLOG_\([A-Z]\)FET_SLVT \(.*\) nl=20n/PLOG_\1FET_LVT \2 nl=14n/'

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 39685d0d891a2570d0a130d05cc602d8