Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Use 2 files and print each line of each one side-by-side

by hippo (Curate)
on Feb 18, 2014 at 23:07 UTC ( #1075397=note: print w/ replies, xml ) Need Help??


in reply to Use 2 files and print each line of each one side-by-side

Are you aware of the paste command? No need to go reinventing the wheel on this one.


Comment on Re: Use 2 files and print each line of each one side-by-side
Re^2: Use 2 files and print each line of each one side-by-side
by Kenosis (Priest) on Feb 19, 2014 at 00:21 UTC

    paste is a nice solution. However, the OP didn't state whether the files had the same number of lines or not, but did mention printing from both files. In the case of files with a different number of lines, paste continues printing up to the end of the larger file--and corresponding blanks for the smaller--after the smaller file's exhausted. This exception does not meet the OP's specs of printing from both files on each line. However, it may be the case the the files have the same number of lines; if so, this simply isn't an issue.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1075397]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (8)
As of 2014-12-19 04:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (70 votes), past polls