A 09:55 29/11/01 -0500, vous avez écrit :
>Got a large text file and I want to output a certain block of lines from
>within that text file that fall between two patterns:
>
><element7>
>This is the stuff I want outputed
></element7>
>
>$ somecommand -start "<element7>" -stop "<element7>"
>
>would output "This is the stuff I want outputed".   I figured some sed guru
>had this thing handy.

try :

cat file | sed -n -e '/<element7>/,/<\/element7>p'

given an input file of

blah
<element7>
This is the stuff I want outputed
</element7>
blah blah

this will output

<element7>
This is the stuff I want outputed
</element7>

if you want to remove tag lines then try :

cat file | sed -n -e '/<element7>/,/<\/element7>p' | grep -E -v
'^</?element7>'

this wil output only

This is the stuff I want outputed



hth


                        - * - * - * - * - * - * -
Bien sûr que je suis perfectionniste !
Mais ne pourrais-je pas l'être mieux ?
        Thierry ITTY
eMail : [EMAIL PROTECTED]               FRANCE



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to