0

Want to add text after the | that comes after TAPE

Nigeria,IP,Nodetype,SITE,nodename,OK|BACKUP|Site|**TAPE**|Daily||**19-Oct-20**|,NA,NA,NA,NA,NA,NA,NA,OK|ZK_bkp|/var/backup/path|Node|Daily||19-Oct-20|,NA,NA

Trying this sed 's/TAPE|.*|.*|/&LAPE/g'

but it adds the string after the last |

seshadri_c
  • 6,906
  • 2
  • 10
  • 24
  • When you use `.*` it's greedy and matches as much as it can. Use `[^|]*` instead if you only want it to match non-pipe characters. – Charles Duffy Oct 14 '20 at 16:39
  • (that's an analogue to how the linked duplicate is trying to avoid matching to the last `/`, just as you're trying to avoid matching to the last `|`; same underlying problem, same solution). – Charles Duffy Oct 14 '20 at 16:40

0 Answers0