I tried this command and only works to certain extend
input file content
this is begin not sure what is wrong end and why not
Command
cat file | sed 's/.*begin \(.*\)end/\1/'
output
not sure what is wrong and why not
desired output ( please see notes below)
not sure what is wrong
1 - my sed command searches for the first pattern and second pattern , but omits the second pattern and prints the text. However, it also prints the rest of the line "why not". I do not want to print what comes after the second pattern only what is between the two patterns. I am not sure how to do this 2 - what id there are two "end" in the same line?
Can someone help please and provide and explain the command?
Regards
Aucun commentaire:
Enregistrer un commentaire