Skip to content
Advertisement

replace text between two tabs – sed

I have the following input files:

JavaScript

and I am trying to find the second string between the two tabs (e.g. text2, abc2) and replace it with another word.

I have tried with

JavaScript

but it only deletes the tab and does not replace the word.

I appreciate any help!

Advertisement

Answer

I would suggest using awk here:

JavaScript

Set the input and output field separators to a tab and change the second field. The 1 at the end is always true, so awk does the default action, { print }.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement