If your files aren't too big, you can slurp the file into a single string. Then you can get the info you need with a simple regex that employs a 'g' flag to get all the matches:
my $text; { local $/ = undef; $text = <DATA>; #"slurp" the whole file } while ($text =~ / (\d+) \. pace (.*?) \d+ \. slow /xmsg ) { print "filename=$1 and text=$2"; } __DATA__ 12345.pace text1 12345.slow 123456.pace text2 123456.slow hyds.pace bla bla bla uiw.slow --output:-- filename=12345 and text= text1 filename=123456 and text= text2
I'll leave the file creation and the writing of the file for you.
In reply to Re: copying lines in a text file to a new file with a dynamically generated text name
by 7stud
in thread copying lines in a text file to a new file with a dynamically generated text name
by seek_m
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |