in reply to Re: append middle of File
in thread append middle of File
#!/usr/bun/perl #------------------------------ # This script searches for "search" # and adds lines from fileSource to fileOutput use warnings; use strict; #use Fcntl (:flock :seek); # Check unless(-e $ARGV[0] || -e $ARGV[1]){ print("Please Enter A Valid File Name\n"); exit 1; } #if($ARGV[0] == "--help"){ # print("Usage is:\n"); # print("perl conference_add.pl <Source File> <Output File> <Sear +ch String>"); #} # assigns file path to local variables my($fileSource) = $ARGV[0]; my($fileOutput) = $ARGV[1]; my(@inputLines); # opens files for reading/writing open(FILESOURCE, "<", $fileSource) || die("Can not open $fileSource $! +"); open(FILEOUT, ">>", $fileOutput) || die ("Can not open $fileOutput $!" +); @inputLines = <FILESOURCE>; print FILEOUT @inputLines; close(FILESOURCE); close(FILEOUT);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: append middle of File
by graff (Chancellor) on Apr 10, 2010 at 19:24 UTC |