unix_95054 has asked for the wisdom of the Perl Monks concerning the following question:
Folks,
I have a large file containing approx 1000+ file contents of similar type. The file looks like below:
<c> ================================== $ cat large_file < file1.txt line1 of file1 line2 of file1 line3 of file1 line4 of file1 < file2.txt line1 of file2 line2 of file2 line3 of file2 < file3.txt line1 of file3 line2 of file3 line3 of file3 line4 of file3 ==================================
I need to create files file1.txt, file2.txt and file3.txt from this large file. The format of actual file is exactly the same hence "<" can be used as file separator and "file1.txt" , "file2.txt" and "file3.txt" should be the outcome.
I can write a shell script using some complex awk/sed functions after devoting couple of hours :-) but I am sure that perl should have small and handy solution for this. Can anyone help me in this?
Thanks.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: How to generate files based on some special character?
by ikegami (Patriarch) on Jul 22, 2008 at 19:34 UTC | |
Re: How to generate files based on some special character?
by toolic (Bishop) on Jul 22, 2008 at 19:37 UTC | |
Re: How to generate files based on some special character?
by AltBlue (Chaplain) on Jul 22, 2008 at 19:47 UTC | |
by AltBlue (Chaplain) on Jul 22, 2008 at 20:00 UTC | |
Re: How to generate files based on some special character?
by poolpi (Hermit) on Jul 22, 2008 at 21:22 UTC | |
Re: How to generate files based on some special character?
by almut (Canon) on Jul 22, 2008 at 20:43 UTC |
Back to
Seekers of Perl Wisdom