Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Perl
Perl Misc
File I/O Manipulation....
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="RodFGWA, post: 4799009"] Thank you all for your replies. I appreciate the time you have spent on my problem. Suppose I use the following solution: #!/usr/bin/perl use warnings; use strict; open FILE, '<', 'text_file' or die "Cannot open 'text_file' $!"; chomp( @ARGV = <FILE> ); close FILE; open OUT, '>>', 'OUTPUT_FILE' or die "Cannot open 'OUTPUT_FILE' $!"; my $lines = 10; while ( <> ) { $. == 1 && print OUT "*****\n"; $. <= $lines && print OUT $_; $. > $lines || eof and close ARGV; } __END__ I chose this one because it seems the likely candidate to extend for what I would ideally like to do. However, Perl is so obscure to me now that I may be wrong about that. I would like to print the lines of each file that begin with an open parenthesis '('. These are the comment lines in the beginning of each file. I originally chose the top ten lines because I thought that would suffice, but upon reflection, I need only the lines that begin with '('. Sometimes there are more than 10 comment lines. Once the comment lines have stopped there are additional lines, but I do not care about these, so I can go on to the next file. Ideally, I would like to print the lines that begin with certain headers beginning with a '(', such as '(CUSTOMER', or '(MATERIAL'. So, read each line Does it begin with '(' OR Does it begin with '(CUSTOMER' If it Does Print the line to the Output File [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Perl
Perl Misc
File I/O Manipulation....
Top