![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| script or piece of code where the data returned by a stored procedure you are writing | enigma_83 | Shell Programming and Scripting | 3 | 04-25-2008 03:44 AM |
| Perl Unix Script Writing | Dinkster | UNIX for Dummies Questions & Answers | 1 | 02-01-2008 12:09 PM |
| help for writing shell script to export table data | sankarg | Shell Programming and Scripting | 3 | 10-18-2006 03:01 AM |
| help writing script file | lanboy_2005 | UNIX for Dummies Questions & Answers | 19 | 03-10-2004 06:58 AM |
| Writing both 8-bit and 16-bit data to a file | Breen | High Level Programming | 1 | 03-03-2004 09:59 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
help for a perl script - writing to a data file
Hi,
Here is my problem.. i have 2 files (file1, file2).. i have wrote the last two lines and first 4 lines of "file2" into two different variables .. say.. my $firstrec = `head -4 $file2`; my $lastrec = `tail -2 $file2`; and i write the rest of the file2 to a tmpfile and cat it with head -4 | tail -2 of file1 ... now i need to add the first line and last lines to this tmpfile... any suggestions are appreciated......thanks |
| Forum Sponsor | ||
|
|
|
|||
|
Quote:
Code:
open (FILE2, 'file2'); my @array = <FILE2>; close FILE2; my @first4 = @array[0..3]; my @last2 = @array[-2,-1]; my @rest_of_lines = @array[4..$#array-2]; But I do not understand this requirement so I can't advise further: Code:
now i need to add the first line and last lines to this tmpfile... |
|||
| Google The UNIX and Linux Forums |