rubydba has asked for the wisdom of the Perl Monks concerning the following question:

I have the DDL output and there are beginning paragraphs such as
CREATE TABLE WCC.CONTACT ,,,, ; CREATE TABLE WCC.CONTACTMETHOD ....
and when I vi the input file the cursor ends and either the T of WCC.CONTACT or the D for WCC>CONTACTMETHOD The issue is that when I code
perl -ne 'print if /CREATE TABLE WCC.CONTACT/ .. /;/' inputfile > outf +ile
I will get both paragraphs. I tried
perl -ne 'print if /CREATE TABLE WCC.CONTACT$/ .. /;/' inputfile > out +file
or other choices and I have yet to be able to show the end of line. grep -p is unavailable in the Linux arena (and it will be Linux at the landing zone) so I could use any/all suggestions

Replies are listed 'Best First'.
Re: Searching for paragraphs but tricky
by hippo (Archbishop) on Jul 17, 2013 at 20:45 UTC

    Are you sure your file isn't in DOS format (ie. CRLF terminators)?

      I did state that it's Linux and it's not a DOS file.

        Hence the question. :)

        Anyway, there's nothing wrong with your syntax as this trivial example demonstrates:

        $ echo -e "CREATE TABLE WCC.CONTACT\nfoo\n;\nCREATE TABLE WCC.CONTACTM +ETHOD\nbar\n;\n" | perl -ne 'print if /CONTACT$/ .. /;/;' CREATE TABLE WCC.CONTACT foo ;

        Therefore the obvious conclusion is that your input file does not contain what you think it contains. Use a hexdump to see what's actually in there.