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.

2
  • ...and quite a bunch of others Aug 22, 2016 at 18:28
  • If you need help with commands, post the exact command you ran and the output.
    – Panther
    Aug 22, 2016 at 18:44

1 Answer 1

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!

Not the answer you're looking for? Browse other questions tagged .