I have a text in a file file.txt like this
xxxxxxxxxxxxxxx
xxxxxxxxxxxxxxx
a b c // delimited by tab
xxxxxxxxxxxxxxx
xxxxxxxxxxxxxxx
I know using sed
I can find and replace text in a file. If a line starts with a b(seperated by a tab) I need to replace it with d e f. So the above file will be
xxxxxxxxxxxxxxx
xxxxxxxxxxxxxxx
d e f // delimited by tab
xxxxxxxxxxxxxxx
xxxxxxxxxxxxxxx
I can do this to find and replace, I want only those instances where the line starts with a b and replace the whole line.
sed -i 's/a/\t/\b/\t\/c/REPLACED TEXT/g' file.TXT