-3

I have a file which contains only one line but it is really really long. I would like to get specific part from the line and replace to something else.

Hereunder an example test :

This is an exemple text should be very long long text in my real case i am trying to find something like start/end with to replace to something else.

I am imagining like -> start with "exemple text" end with "real case"

Expected result : "exemple text should be very long long text in my real case"

to replace : empty

Could you please help me ?

Kate
  • 1

1 Answers1

0

Look this up, assuming you use bash:

myString="This is an exemple text should be very long long text in my real case i am trying to find something like start/end with to replace to something else."
echo "${myString/"This is an exemple text should be very long long text in my real case i am trying to find something like start/end with to replace to something else."/"exemple text should be very long long text in my real case"}"
Notiq
  • 21
  • 11
  • the thing is the block which i want to replace has more than 200 characters.... this is why i am trying to find some kind of "start" to precise first and last word of this block.. – Kate Jan 25 '23 at 17:08