Sponsored Content
Top Forums UNIX for Beginners Questions & Answers How to paste multiple files in parallel? Post 303033022 by notimenocall on Thursday 28th of March 2019 01:09:49 PM
Old 03-28-2019
How to paste multiple files in parallel?

Hi all,

I am trying to paste thousands of files together into a matrix. Each file has only 1 column and all the files have the same number of rows (~27k rows). I tried
paste * > output as well as some other for loops
but the output only contains the columns from the 1st and last files. The format of the files are as followed. It has a header which is identical to the file name:
Code:
12345
0.0
0.0
0.0

...

Please help!


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

Last edited by RudiC; 03-28-2019 at 05:48 PM.. Reason: Added CODE tags.
 

10 More Discussions You Might Find Interesting

1. High Performance Computing

Parallel Execution on Multiple System

Hi All, I am working on a project where I need to execute set of arguments (around 500) on a Simulator. If I execute this on one linux (RedHat 8.0) machine it will approximately takes 2~3 days. Since I am having more linux machines am thinking of executing these on different machines in... (7 Replies)
Discussion started by: 123an
7 Replies

2. Shell Programming and Scripting

Need to run same script multiple times in parallel

Hi all, I have a requirement in which a script invokes a Java program. Lets say script ABC invokes a java program with cfg file a parameter. This script takes 10 minutes to execute . Like this ineed to run the program 10 times meaning 100 minutes if i do it sequentially. If i open... (2 Replies)
Discussion started by: rahman_riyaz
2 Replies

3. Shell Programming and Scripting

Calling multiple functions in parallel

Hello, I have multiple functions within a shell script. eg. function_database_backup, unix_tar_creation, etc. I would like to run these functions in parallel, as each is independent of the other. If these were simple commands, I could have probably run each of the commands in background. ... (1 Reply)
Discussion started by: neil.k
1 Replies

4. Shell Programming and Scripting

scp or rsync multiple files in parallel from a remote host

Hi. I'm trying to speed up an rsync command by running it in parallel. There's no real option for this other than if the files are in multiple directories (which they're not). And even then there's no way of knowing if rsync has succeeded as the process is running in the background .. and... (4 Replies)
Discussion started by: Big_Jeffrey
4 Replies

5. Shell Programming and Scripting

Multiple child running parallel

Hi , I am using sun Solaris machine. The machine description is given below SunOS ptxsa021 5.9 Generic_118558-24 sun4u sparc SUNW,Sun-Fire-15000 I am using korn shell.the scripts is below Parent code is given below..it is the part of code #!/bin/ksh # Script Name:... (3 Replies)
Discussion started by: ashutosh2378
3 Replies

6. Shell Programming and Scripting

Paste multiple files, but only the sorted head -50

Hello, I want to merge multiple files (under hundreds folders) side by side. File name are the same but folder are different. like folder1/same_name.txt folder2/same_name.txt folder3/same_name.txt ......Normally it can be done as paste /different_path*/same_name.txt > merged_file.txtbut... (2 Replies)
Discussion started by: yifangt
2 Replies

7. Shell Programming and Scripting

Executing Multiple Queries in parallel in Shell

I have n number of SQL queries needs to executed in Shell. Result of this query need to assign in a variable. Once all the queries are executed script needs to exit. Sample Query: SQL 1: Select Count(*) from TABLE GROUP BY COL1,COL2 SQL 2: Select Count(*) from TABLE GROUP BY COL1,COL2 ... (2 Replies)
Discussion started by: Niranjancse
2 Replies

8. Shell Programming and Scripting

Paste columns based on common column: multiple files

Hi all, I've multiple files. In this case 5. Space separated columns. Each file has 12 columns. Each file has 300-400K lines. I want to get the output such that if a value in column 2 is present in all the files then get all the columns of that value and print it side by side. Desired output... (15 Replies)
Discussion started by: genome
15 Replies

9. UNIX for Beginners Questions & Answers

How to copy a column of multiple files and paste into new excel file (next to column)?

I have data of an excel files as given below, file1 org1_1 1 1 2.5 100 org1_2 1 2 5.5 98 org1_3 1 3 7.2 88 file2 org2_1 1 1 2.5 100 org2_2 1 2 5.5 56 org2_3 1 3 7.2 70 I have multiple excel files as above shown. I have to copy column 1, column 4 and paste into a new excel file as... (26 Replies)
Discussion started by: dineshkumarsrk
26 Replies

10. UNIX for Beginners Questions & Answers

How to copy particular files from a multiple directories and paste in a new directory?

Dear all I have a multiple directories, say for example org1, org2, org3 ..... org100 and each directory having a file namely dnaG.fasta. I need to copy all the dnaG.fasta file from each directory and paste in another directory fastconcatg. Therefore, my script has to copy dnaG.fasta file from... (5 Replies)
Discussion started by: dineshkumarsrk
5 Replies
paste(1)						      General Commands Manual							  paste(1)

NAME
paste - Joins corresponding lines of several files or subsequent lines in one file SYNOPSIS
paste [-d list] [-s] file... STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: paste: XCU5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. OPTIONS
Replaces the delimiter that separates lines in the output (tab by default) with one or more characters from list. If list contains more than one character, then the characters are repeated in order until the end of the output. In parallel merging, the lines from the last file always end with a newline character, instead of one from list. The following special characters can be used in list: Newline character Tab Backslash Empty string (not a null character) [Tru64 UNIX] An extended character You must quote characters that have special meaning to the shell. Merges all lines from each input file into one line of output (serial merging). Using this option, the paste command merges all lines in the first input file forcing a newline before at the end. The command then continues with the next input file, continuing in the same manner until all input files have been completed. A tab separates the input lines unless you use the -d option. Regardless of the list, the last character of the output is a newline character. OPERANDS
The name of an input file. You may specify up to 12 files, including hyphens. If you specify a -, paste reads standard input recursively, one line for each -. DESCRIPTION
Specifying the -d option or no options causes the paste command to treat each file as a column, joining them horizontally with a tab char- acter by default (parallel merging). Using the -s option, the paste command combines all lines of each input file into one output line (serial merging). These lines are joined with the tab character by default. Output lines can be any length. [Tru64 UNIX] The output of pr -t -m is similar to the output produced by the paste command, but pr with its options creates extra spaces, tabs, and lines for an enhanced page layout. RESTRICTIONS
If the -s option is not used, it is an error if any specified file cannot be opened. EXIT STATUS
The following exit values are returned: Successful completion. An error occurred. EXAMPLES
To paste several columns of data together, enter: paste names places dates > npd This creates a file named npd that contains the data from names in one column, places in another, and dates in a third. The columns are separated by tab characters. File npd then contains: rachel New York 28 February jerzy Warsaw 27 April mata Nairobi 21 June michel Boca Raton 27 July segui Managua 18 November A tab character separates the name, place, and date on each line. To separate the columns with a character other than a tab (sh only), enter: paste -d"!@" names places dates > npd This alternates the apostrophe (!) and the at sign (@) as the column separators. If names, places, and dates are the same as in Example 1, then npd contains: rachel!New York@28 February jerzy!Warsaw@27 April mata!Nairobi@21 June michel!Boca Raton@27 July segui!Managua@18 November To dis- play the standard input in multiple columns, enter: ls | paste - - - - This lists the current directory in four columns. Each hyphen (-) tells the paste command to create a column containing data read from the standard input. The first line is put in the first column, the second line in the second column, ... and then the fifth line in the first column, and so on. This is equivalent to ls | paste -d" " -s - which fills the columns across the page with subsequent lines from the standard input. The -d defines the character to insert after each column: a tab character ( ) after the first three columns, and a newline character ( ) after the fourth. Without the -d option, paste -s - displays all of the input as one line with a tab between each column. To merge the lines of the file names above into one output line, enter: paste -s names This results in: rachel jerzy mata michel segui ENVIRONMENT VARIABLES
The following environment variables affect the execution of paste: Provides a default value for the internationalization variables that are unset or null. If LANG is unset or null, the corresponding value from the default locale is used. If any of the internationalization vari- ables contain an invalid setting, the utility behaves as if none of the variables had been defined. If set to a non-empty string value, overrides the values of all the other internationalization variables. Determines the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multibyte characters in arguments and input files). Determines the locale for the format and contents of diagnostic messages written to standard error. Determines the location of message catalogues for the processing of LC_MESSAGES. SEE ALSO
Commands: cut(1), grep(1), fold(1), join(1), pr(1) Standards: standards(5) paste(1)
All times are GMT -4. The time now is 03:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy