![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | 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 and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| 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 06:44 AM |
| Perl Unix Script Writing | Dinkster | UNIX for Dummies Questions & Answers | 1 | 02-01-2008 04:09 PM |
| help for writing shell script to export table data | sankarg | Shell Programming and Scripting | 3 | 10-18-2006 06:01 AM |
| help writing script file | lanboy_2005 | UNIX for Dummies Questions & Answers | 19 | 03-10-2004 10:58 AM |
| Writing both 8-bit and 16-bit data to a file | Breen | High Level Programming | 1 | 03-03-2004 01:59 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | 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 |
|
||||
|
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... |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|