sed delete lines between words

I‘ve a file as follows:

This is a test.
One bang two three
Foo dang Bar
001 0xfg 0xA
002 0xA foo bar 0xfG
I'm done

How do I delete all “words” from the above file which ends with a particular letter (say ‘g’) in each line? The output should be as follows:

This is a test.
One two three
Foo Bar
001 0xA
002 0xA foo bar
I'm done

How do I delete regex-based word using sed or awk under Linux / Unix like operating systems?

{ 6 comments }

Q. How do I find the text between the strings FOO and BAR inclusive using sed command line option?

{ 36 comments }

Q. How do I use sed for selective deletion of certain lines? I have text as follows in file: Line 1 Line 2 WORD1 Line3 Line 4 WORD2 Line5 I would like to delete all lines between WORD1 and WORD2 to produce final output: Line 1 Line 2 Line5 A. For selective deletion of certain […]

{ 10 comments }