-2

For example I have QQQQQ111025 in a middle of a line. Where 1 can be any character numerical or alphabetical. I need to insert 1 in the front of the QQQQQ or I need to replace the QQQQQ with 1. Keep in mind the 025 has to be 025 so simple substitution will not do as it would alter 111 that may be any character and I need to keep it as original character.

Anthon
  • 79,293
  • 1
    I was sure this was a duplicate, but . . . -- you could also revise the question to make it clearer. – hildred Apr 10 '15 at 22:21

1 Answers1

1

To insert 1 in front of QQQQQ you can use sed 's/QQQQQ/1&/'. To replace the QQQQQ with 1 you can use sed 's/QQQQQ/1/'.

I don't understand your concern about avoiding "simple substitution". If my suggestions are not suitable please update your Question with examples of "before" and "after" a typical substitution.

Chris Davies
  • 116,213
  • 16
  • 160
  • 287