Computing.Net > Forums > Unix > merge 2 files using perl

merge 2 files using perl

Reply to Message Icon

Original Message
Name: gounix
Date: June 4, 2007 at 00:47:26 Pacific
Subject: merge 2 files using perl
OS: SunOS
CPU/Ram: xx
Model/Manufacturer: xx
Comment:

Hi Could anybody give me way out in perl
to create a target file from two source files as given below

file1
line1..
line2..

file2
line1..
line2...

expected output file should be
line1 of file1 line1 of file2
line2 of file1 line2 of file2
...
..

Thanks


Report Offensive Message For Removal


Response Number 1
Name: nails
Date: June 4, 2007 at 07:03:23 Pacific
Reply: (edit)

Unless you are doing homework, you don't need perl for this problem. Use the paste command:

paste file1 file2 > outputfile



Report Offensive Follow Up For Removal

Response Number 2
Name: gounix
Date: June 8, 2007 at 00:14:46 Pacific
Reply: (edit)

Thanks nails.

I know this option.

But paste is having limitation (atleast in my SunOS) that it can read aournd 500 characters.
I have a file containing 15000 characters long lines in it

pass out comments if any



Report Offensive Follow Up For Removal

Response Number 3
Name: gounix
Date: June 8, 2007 at 00:15:51 Pacific
Reply: (edit)


refresh


Report Offensive Follow Up For Removal

Response Number 4
Name: gounix
Date: June 8, 2007 at 00:17:01 Pacific
Reply: (edit)

refresh r



Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: merge 2 files using perl

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




Have you ever used OpenOffice?

Yes, as my main suite.
Yes, occationally.
Yes, but only once.
No, never.


View Results

Poll Finishes In 5 Days.
Discuss in The Lounge