perl Split a text file into multiple files

October 20, 2010 at 23:19:03
Specs: Macintosh
I have a file with all view definitions inside which I exported from database. typically the view will be starting with "CREATE" or "REPLACE" word. How can I use perl inside a ksh to split the file into multiple file(basically for each view I want to create one file)

See More: perl Split a text file into multiple files

Report •

#1
October 21, 2010 at 19:39:57
Use a regex to match the desired words and when it matches, close the prior file (if needed) and open a new file and output the lines until the next match.

See:
perldoc -f open
perldoc -f close
perldoc perlrequick
perldoc perlretut


Report •
Related Solutions


Ask Question