in reply to Re: Match multiple lines
in thread Match multiple lines

Thank you for your reply, I think you misunderstand me. I need a regex pattern that matches everything following the header to the end of the file. The file contains multiple lines. The script is able to match the first line, following the header, of each file and append them together into a single file. But I don't want the regex pattern to stop at the first newline, I want it to match all characters, even newline. I've also been confused by the if ($_ != /\.ktf$/) code, but it's the only thing that worked. It returns true if filename ends with .ktf. It looks inverted to me though... anyway, it works so...

Replies are listed 'Best First'.
Re^3: Match multiple lines
by WeeDie (Novice) on Sep 19, 2009 at 16:09 UTC
    For example, this is the results running the script in a directory containing 10 ktf files.
    %,0,N59°3.248' E13°2.656',65.99,2009-09-16 09:51:42,,,$ %,0,N59°3.577' E13°2.460',53.97,2009-09-16 10:05:38,,,$ %,0,N59°3.576' E13°2.462',55.89,2009-09-16 10:07:51,,,$ %,0,N59°3.648' E13°2.924',55.89,2009-09-16 10:14:10,,,$ %,0,N59°3.652' E13°2.937',55.41,2009-09-16 10:19:17,,,$ %,0,N59°3.454' E13°3.092',55.89,2009-09-16 10:25:05,,,$ %,0,N59°3.453' E13°3.467',58.30,2009-09-16 10:31:30,,,$ %,0,N59°3.451' E13°3.466',57.34,2009-09-16 10:36:06,,,$ %,0,N59°3.473' E13°3.605',60.70,2009-09-16 10:39:35,,,$ %,0,N59°3.452' E13°3.467',56.37,2009-09-16 10:42:49,,,$

    The regex pattern stops at newline instead of matching until the end of file. I've tried the m modifier with no luck...

    Example: print MYFILE /^(%,0,.*)/ms