×
UNIX.COM Login
Username:
Password:  
Show Password






👤


Shell Programming and Scripting

BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

How to joint multiple value to 1 files?

👤 Login to reply

 
Thread Tools Search this Thread Display Modes
    #1  
Old 03-12-2018
fajar_3t3 fajar_3t3 is offline
Registered User
 
Join Date: Oct 2017
Last Activity: 19 March 2018, 12:42 AM EDT
Posts: 9
Thanks: 5
Thanked 0 Times in 0 Posts
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:
How to joint multiple value to 1 files? Please use CODE tags as required by forum rules!

Last edited by RudiC; 03-12-2018 at 09:54 AM.. Reason: Added CODE tags.
Sponsored Links
    #2  
Old 03-12-2018
RudiC RudiC is offline Forum Staff  
Moderator
 
Join Date: Jul 2012
Last Activity: 16 July 2018, 3:46 PM EDT
Location: Aachen, Germany
Posts: 13,062
Thanks: 447
Thanked 4,011 Times in 3,688 Posts
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.
Sponsored Links
    #3  
Old 03-12-2018
rdrtx1 rdrtx1 is offline Forum Advisor  
Registered Pusher
 
Join Date: Sep 2012
Last Activity: 31 May 2018, 9:41 AM EDT
Location: Houston, Texas, USA
Posts: 1,142
Thanks: 0
Thanked 421 Times in 398 Posts


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 11:14 AM.. Reason: add header line
The Following User Says Thank You to rdrtx1 For This Useful Post:
RudiC (03-12-2018)
Sponsored Links
👤 Login to reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Run one script on multiple files and print out multiple files. grace_shen Shell Programming and Scripting 4 10-07-2013 12:08 PM
awk, multiple files input and multiple files output gabrysfe Shell Programming and Scripting 5 05-29-2012 04:45 AM
Using AWK: Extract data from multiple files and output to multiple new files Liverpaul09 UNIX for Dummies Questions & Answers 3 10-12-2010 03:59 AM
Joint two files ! csierra Shell Programming and Scripting 3 01-27-2010 11:52 PM



All times are GMT -4. The time now is 10:08 PM.

Unix & Linux Forums Content Copyright©1993-2018. All Rights Reserved.