Lets say that I have a file with below content:
Create table table_new as (
Select colA1,colA2,colA3
from tableA,
(Select col1 from tableB)
Now I want to replace everything between Create and from (first occurrence) words with space. i.e I want the output
tableA,
(Select col1 from tableB)
I tried the below approach.
replaced the new line character with # (random choice), so that I can use sed command.
tried the command
sed -r 's/Create[^from].*from//ig' filename > new_file_name
The above command for me is replacing Create to 2nd occurrence of from and I'm remaining with "tableB)"
Could any one please help me how I can replace only till the first from word? It would be really helpful if you could explain the answer as well.