How to joint multiple value to 1 files?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to joint multiple value to 1 files?
# 1  
Old 03-12-2018
How to joint multiple value to 1 files?

HI All

need your help i want joint multiple value from 4 files to 1 files.

example like below :

file 1 :

Code:
20:22|303
20:23|287
20:24|318
20:25|307
20:26|315

file 2 :

Code:
306
288
319
309
310

file 3 :

Code:
304
289
323
311
313

file 4 :

Code:
301
281
311
301
318

expectation join files :

Code:
time|file1|file2|file3|file4
20:22|303|306|304|301
20:23|287|288|289|281
20:24|318|319|323|311
20:25|307|309|311|301
20:26|315|310|313|318

Thanks for help

regards
Fajar


Moderator's Comments:
Mod Comment Please use CODE tags as required by forum rules!

Last edited by RudiC; 03-12-2018 at 10:54 AM.. Reason: Added CODE tags.
# 2  
Old 03-12-2018
No attempts / ideas / thoughts from your side? Try

Code:
paste -d'|||\n' file[1-4]
20:22|303|306|304|301
20:23|287|288|289|281
20:24|318|319|323|311
20:25|307|309|311|301
20:26|315|310|313|318

Tested on Ubuntu linux 17.10.
# 3  
Old 03-12-2018
Code:
{ echo time ; ls -1 file*; } | awk '$1=$1' RS= OFS="|"
pr -t -m -J -S"|" file*


Last edited by rdrtx1; 03-12-2018 at 12:14 PM.. Reason: add header line
This User Gave Thanks to rdrtx1 For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed parser behaving strange on replacing multiple words in multiple files

I have 4000 files like $cat clus_grp_seq10_g.phy 18 1002 anig_OJJ65951_1 ATGGTTTCGCAGCGTGATAGAGAATTGTTTAGGGATGATATTCGCTCGCGAGGAACGAAGCTCAATGCTGCCGAGCGCGAGAGTCTGCTAAGGCCATATCTGCCAGATCCGTCTGACCTTCCACGCAGGCCACTTCAGCGGCGCAAGAAGGTTCCTCG aver_OOF92921_1 ... (1 Reply)
Discussion started by: sammy777888
1 Replies

2. Shell Programming and Scripting

Removing carriage returns from multiple lines in multiple files of different number of columns

Hello Gurus, I have a multiple pipe separated files which have records going over multiple Lines. End of line separator is \n and records going over multiple lines have <CR> as separator. below is example from one file. 1|ABC DEF|100|10 2|PQ RS T|200|20 3| UVWXYZ|300|30 4| GHIJKL|400|40... (7 Replies)
Discussion started by: dJHa
7 Replies

3. Shell Programming and Scripting

Grep strings on multiple files and output to multiple files

Hi All, I want to use egrep on multiple files and the results should be output to multiple files. I am using the below code in my shell script(working in Ksh shell). However with this code I am not attaining the desired results. #!/bin/ksh ( a="/path/file1" b="path/file2" for file in... (4 Replies)
Discussion started by: am24
4 Replies

4. Shell Programming and Scripting

Run one script on multiple files and print out multiple files.

How can I Run one script on multiple files and print out multiple files. FOR EXAMPLE i want to run script.pl on 100 files named 1.txt ....100.txt under same directory and print out corresponding file 1.gff ....100.gff.THANKS (4 Replies)
Discussion started by: grace_shen
4 Replies

5. UNIX for Dummies Questions & Answers

Run one script on multiple files and print out multiple files.

How can I run the following command on multiple files and print out the corresponding multiple files. perl script.pl genome.gff 1.txt > 1.gff However, there are multiples files of 1.txt, from 1----100.txt Thank you so much. No duplicate posting! Continue here. (0 Replies)
Discussion started by: grace_shen
0 Replies

6. Shell Programming and Scripting

Column extraction from multiple files to multiple files

I have roughly ~30 .txt files in a directory which all have unique names. These files all contain text arranged in columns separated by whitespace (example file: [#YY MM DD hh mm WDIR WSPD GST WVHT DPD APD MWD PRES ATMP WTMP DEWP VIS TIDE #yr mo dy hr mn degT m/s m/s m sec ... (5 Replies)
Discussion started by: aozgaa
5 Replies

7. Shell Programming and Scripting

awk, multiple files input and multiple files output

Hi! I'm new in awk and I need some help. I have a folder with a lot of files and I need that awk do something in each file and print a new file with the output. The input file name should be modified when I print the outpu files. Thanks in advance for help! :-) ciao (5 Replies)
Discussion started by: gabrysfe
5 Replies

8. UNIX for Dummies Questions & Answers

Using AWK: Extract data from multiple files and output to multiple new files

Hi, I'd like to process multiple files. For example: file1.txt file2.txt file3.txt Each file contains several lines of data. I want to extract a piece of data and output it to a new file. file1.txt ----> newfile1.txt file2.txt ----> newfile2.txt file3.txt ----> newfile3.txt Here is... (3 Replies)
Discussion started by: Liverpaul09
3 Replies

9. Shell Programming and Scripting

Joint two files !

Hello Group, I request you your help in order create a script for joint two files in one. The idea is to create a new row where the date is the same in both files. file 1 1/1/2010, 2 1/2/2010, 4 1/3/2010, 6 1/4/2010, 8 1/5/2010, 10 file 2 1/1/2010, 3 1/2/2010, 6... (3 Replies)
Discussion started by: csierra
3 Replies
Login or Register to Ask a Question