Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Alternate line printing between contents of 2 files

Status
Not open for further replies.

Mariko

ISP
Oct 2, 2001
17
0
0
US
Hi There,
Could someone help me make a script code wherein it could alternately print line contents between 2 files (file1 and file2)?
Ex. file1 file2
1... 1.1..
2... 2.2..
3... 3.3..
Output File
1...
1.1..
2...
2.2..
3...
3.3..
Thanks very much! =D
-Miwa

 

Hi Mariko!

Today is sad day in America and around the world, but, if you need help, it's here. Please, try this awk example:

Code:
awk '{ print; getline row2 < &quot;file2&quot;; print row2 }' file1


God bless you!

Bye!

KP.
 
Or [tt]paste -d&quot; &quot; filename1 filename2[/tt]
I hope it works...
Unix was made by and for smart people.
 
Thanks! Something to Share...
PERFECT PEACE
There once was a King who offered a prize to the artist who would paint the best picture of peace. Many artists tried. The King looked at all the pictures, but there were only two he really liked.
One picture was of a calm lake. The lake was a perfect mirror, for peaceful towering mountains were all around it. Overhead was a blue sky with fluffy white clouds. All who saw this picture thought that it was a perfect picture of peace.
The other picture had mountains too. But these were rugged and bare. Above was an angry sky from which rain fell, in which lightening played. Down the side of the mountain tumbled a foaming waterfall. This did not look peaceful at all. But when the King looked, he saw behind the waterfall a tiny bush growing in a crack in the rock. In the bush a mother bird had built her nest. There, in the midst of the rush of angry water, sat the mother bird on her nest ... perfect peace.
The King chose the second picture. Do you know y? &quot;Because,&quot; explained the King, &quot;peace does not mean to be in a place where there is no noise, trouble, or hard work. Peace means to be in the midst of all those things and still be calm in your heart. That is the real meaning of peace.
-Anonymous
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top