How to merge some files with diffrent sizes into one excel file using shell?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to merge some files with diffrent sizes into one excel file using shell?
# 1  
Old 07-15-2013
How to merge some files with diffrent sizes into one excel file using shell?

Hii

I have these files , and I want to merge them in an excel file
each file have two columns

file1
Code:
title1
1 1 
2 2 
3 3

file2
Code:
title2
5 5
6 6 
7 7
8 8 
9 9
10 10

file 3
Code:
title3
21 21
22 22
23 23
24 24

i use command below to merge them in a excel file
Code:
paste file* > out.csv

the normal output is ok,but when i put it in an excel file(out.csv), the output become like this
Code:
title1 title2 title3
1  1   5  5    21  21
2  2   6  6    22  22
3  3   7  7    23  23
    8  8   24  24
    9  9
   10 10

but i want this output
Code:
title1 title2 title3
1  1   5  5   21  21
2  2   6  6   22  22
3  3   7  7   23  23
       8  8   24  24
       9  9 
      10 10

each number should be in seprate cells,seprate columns and exactly below each other
but when the size of a file is longer than the previous file, the additional numbers go back to last column and below the previous file numbers,for example numbers 8,9,10 and 24

what can i do????
# 2  
Old 07-15-2013
Your required output is some how misleading.How can title1 or title2 or title3 are on the top of two coumns. Can u specify what exactly you need.
# 3  
Old 07-15-2013
Try this

Code:
paste -d , file1 file2 file3

The comma delimiter might help with the justification in excel
# 4  
Old 07-15-2013
Quote:
Originally Posted by millan
Your required output is some how misleading.How can title1 or title2 or title3 are on the top of two coumns. Can u specify what exactly you need.
The titles are not important for me. you suppose that without titles
i want to paste columns with diffrent sizes in regular,in an excel file

---------- Post updated at 02:51 AM ---------- Previous update was at 02:47 AM ----------

Quote:
Originally Posted by krishmaths
Try this

Code:
paste -d , file1 file2 file3

The comma delimiter might help with the justification in excel
It doesn't work Smilie
# 5  
Old 07-15-2013
Make your three input files to csv .Like


If you have large no of contents place those in excel..it will also create the csv files or else separate the entries with comma.

Then you try joining with paste command...it will work..

paste -d "," file1 file2 file3
# 6  
Old 07-15-2013
Quote:
Originally Posted by millan
Make your three input files to csv .Like


If you have large no of contents place those in excel..it will also create the csv files or else separate the entries with comma.

Then you try joining with paste command...it will work..

paste -d "," file1 file2 file3
It workes but in output, each two columns of files,print in one column.
and when i seprate them with space,again become irregular
# 7  
Old 07-15-2013
If the number of records in each file is same then this approach would work. The problem to tackle here is how to paste files with varying number of records.
This User Gave Thanks to krishmaths For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Tabbed multiple csv files into one single excel file with using shell script not perl

Hi Experts, I am querying backup status results for multiple databases and getting each and every database result in one csv file. so i need to combine all csv files in one excel file with separate tabs. I am not familiar with perl script so i am using shell script. Could anyone please... (4 Replies)
Discussion started by: ramakrk2
4 Replies

2. Shell Programming and Scripting

How to list files names and sizes in a directory and output result to the file?

Hi , I'm trying to list the files and output is written to a file. But when I execute the command , the output file is being listed. How to exclude it ? /tmp file1.txt file2.txt ls -ltr |grep -v '-' | awk print {$9, $5} > output.txt cat output.txt file1.txt file2.txt output.txt (8 Replies)
Discussion started by: etldeveloper
8 Replies

3. Shell Programming and Scripting

Merge two files on awk/shell

Hi, i have two files like these: FILE 1 00:0f:35:1b:0c:00 1402691094.750049000 00:0f:35:1b:0c:00 1402691087.474893000 44:d3:ca:fd:a2:08 1402691091.865127000 30:e4:db:c1:df:de 1402691090.192464000 FILE 2_ 00:0F:35 Cisco Systems, Inc 30:E4:DB Cisco Systems, Inc I need a file 3, that... (5 Replies)
Discussion started by: bertiko
5 Replies

4. Shell Programming and Scripting

Merge Two files on the basis of 2 columns at diffrent position

Hello, I am trying to merge two files with multiple records having a common columns but on first file its on 7th column and on 2nd file it on 6th column. First file(file1.txt) - 7th Column is unique H|123|Alex|Ren|W|9856746|2345789|20152202| H|97654|Ray|John||9855678|2345790|20152201|... (6 Replies)
Discussion started by: Mannu2525
6 Replies

5. Shell Programming and Scripting

To merge different sizes txt files

Hi, I have to .txt files that look like "baseMean" "log2FoldChange" "lfcSE" "stat" "pvalue" "padj" "c104215_g2_i4" 202.057864855455 5.74047973414006 1.14052672909697 5.03318299141063 4.8240223910525e-07 0.00234905721174879 "c91544_g1_i1" 373.123487095726 5.62496675850204 1.15060014539303... (2 Replies)
Discussion started by: alisrpp
2 Replies

6. Shell Programming and Scripting

Perl script to Merge contents of 2 different excel files in a single excel file

All, I have an excel sheet Excel1.xls that has some entries. I have one more excel sheet Excel2.xls that has entries only in those cells which are blank in Excel1.xls These may be in different workbooks. They are totally independent made by 2 different users. I have placed them in a... (1 Reply)
Discussion started by: Anamika08
1 Replies

7. Shell Programming and Scripting

Merge two cells in excel via UNIX?

Hi UNIX Gods! Is it possible to merge two cells in .csv file using unix commands? Imagine that this is my present csv file opened via excel: Gate Reports| | fatal alerts | 200 | is is possible to make it look like this using unix? Gate Reports | fatal... (1 Reply)
Discussion started by: 4dirk1
1 Replies

8. Shell Programming and Scripting

combine 3 excel files using shell.

Is there any way to combine 3 excel files into one comma separated file, after removing the header row from all the three files. Is this possible? I have looked in FAQ and I did not find anything. Appreciate any suggestions or links to resources. Radhika. (11 Replies)
Discussion started by: radhika
11 Replies

9. Shell Programming and Scripting

create diffrent files based on other file and parameters list

I would like ot create shell script/ bash to create diffrent files based on a file and parameters list. Here is the detail example: I have a textfile and four static parameter files (having ‘?'). mainfile.txt has below records (this count may be more than 50) A200001 A200101 B200001... (9 Replies)
Discussion started by: raghav525
9 Replies

10. Shell Programming and Scripting

shell script to merge files

Can anybody help me out with this problem " a shell program that takes one or any number of file names as input; sorts the lines of each file in ascending order and displays the non blank lines of each sorted file and merge them as one combined sorted file. The program generates an error... (1 Reply)
Discussion started by: arya
1 Replies
Login or Register to Ask a Question