On Thu, 29 Nov 2001, Eric Wood wrote: > 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.
I can't help you with sed, but this is trivial in perl with the range operator ".." Put this in a file and invoke with ./myscript.pl file_list #!/usr/bin/perl -n if ( /<element7>/ .. /<\/element7>/ ) { print unless /<\/?element7>/; } hth charles _______________________________________________ Redhat-list mailing list [EMAIL PROTECTED] https://listman.redhat.com/mailman/listinfo/redhat-list