• Uncategorized

About linux : pipe-sequence-of-list-of-quoted-segments-of-text-In-linux

Question Detail

I need to write a pipe sequence of list of quoted segments of text that contain question marks which a quoted segment of text starts and ends with a double quote character (“) and has no other double quote character.

I tried to do it like this but i dont get all the quotes:

cat story.txt | grep -E | sed -r "s/\n\"/ \"/ 

Question Answer

Suggesting single line awk script:

awk 'NR%2-1&&/?/{print}' RS='\"' input.txt

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.