0

I need to replace a string in 14th to 20th position in a file with input value

String = A2245 4764ABC0000342

string to be replace = 0000342 with 0000992

I tried using sed but did not work.

joech
  • 1

1 Answers1

2

You can do it with sed with the -i command to edit in place.

Example:

$ cat testfile
A2245 4764ABC0000342

$ sed -i 's/0000342/0000992/' testfile

$ cat testfile
A2245 4764ABC0000992

Hope this helps!

Terrance
  • 41,612
  • 7
  • 124
  • 183