Combine data out of 3 files into one new file

Hi,

How can I combine the data of of three files into one new file?
I try to give as much informations as possible.

The three existing files are called file1 file2 and file3
the new file should named output_combined.

The size of the files will be around 900 words/lines each .. but always the same amount in every file so no "free" or missing lines.

The content of file1 looks like this:

word1
word2
word3
word4

content of file2 like:

192.168.1.2
192.168.1.3
192.168.1.4
192.168.1.5

and file3 :

word1x
word2x
word3x
word4x

The new created file should be formatted as a table separated by a semicolon

word1;192.168.1.2;word1x
word2;192.168.1.3;word2x
[....]

and so on

Platform is

Oracle Solaris 10 1/13 s10s_u11wos_24a SPARC
GNU bash, version 3.2.52(1)-release (sparc-sun-solaris2.10)

Thanks and Regards!

Welcome MyMemberName,

I have a few to questions pose in response first:-

  • Is this homework/assignment? There are specific forums for these.
  • What have you tried so far?
  • What output/errors do you get?
  • What OS and version are you using?
  • What are your preferred tools? (C, shell, perl, awk, etc.)
  • What logical process have you considered? (to help steer us to follow what you are trying to achieve)

Most importantly, What have you tried so far?

There are probably many ways to achieve most tasks, so giving us an idea of your style and thoughts will help us guide you to an answer most suitable to you so you can adjust it to suit your needs in future.

We're all here to learn and getting the relevant information will help us all.

Thanks, in advance,
Robin

Hi

thank you for the response!

You don't have to answer if you don't want to..
I administrate a network monitoring system and i want to gather datas from a database into one file.
And i am just able to make a database request for one attribute at once.
So far i have gathered all necessary datas into 3 files...

So no .. this is no homework...

Questions regarding OS are already answered .. and tool ... im fine with shell, awk and all the other "onboard" tool - and perl but without special modules..

Greetings!

This looks like a simple case of paste

paste -d";" file* > output_combined
1 Like

I agree with the answer, but I wanted to see how far MyMemberName was getting so that he/she would learn from a nudge rather than a full answer.

People learn best by doing rather than just copying a working solution.

Robin

Thank you to senhia83!

And fully agree to you rbatte1! :b:

BUT in business sometimes it just have to run without much of testing, working in and spending time ( time is money :stuck_out_tongue: ) on things other people can resolve in no time because they just know how.

Good day and nice weekend!