Questions tagged [paste]

The `paste` utility merges corresponding or subsequent lines of files.

Filter by
Sorted by
Tagged with
-1 votes
2 answers
73 views

Merging multiple csv files without data shifting to the left

Im trying to merge several csv files into one big file. All these files have different column lengths and others only have a header (no data). When I use paste -d "," file1.csv file2.csv ...
1 vote
1 answer
40 views

paste command puts data from csv files vertically line by line instead of horizontally next to each other

I have a few csv-s, each containing 3 columns separated by ",". Example: header1,header2,header3 value1,value2,value3 value1,value2,value3 ... Using this tutorial, I thought if I execute ...
  • 61
2 votes
1 answer
93 views

Remove \r in between merged csv file with paste command

I merged 3 csv files with command like this. paste -d "," a.csv b.csv c.csv > result.csv The resulting csv has an unexpected line break in between columns of b.csv and c.csv in each line ...
2 votes
1 answer
128 views

Why does paste command truncate one of the input files?

I have two files which contain only one column of numeric data each, and the same number of rows. When using paste, it does combine the rows from the two files into one row, but the text of the first ...
  • 365
0 votes
1 answer
539 views

Merge all csv files in directory column wise

Say the directory contained 3 csv files: The first csv: Name, John Age, 18 The second csv: Name, Jim Age, 21 The third csv: Name, Amy Age, 22 I would want the result to be: Name, John, Jim, Amy Age,...
  • 25
0 votes
1 answer
85 views

Understanding the unix Paste command with input redirection

I am trying to understand the implementation of the paste command in unix when there is a file from input redirection. Assuming the following files: A.txt: A B C D B.txt: 1 2 3 4 The unix command: ...
  • 1
4 votes
3 answers
290 views

Merging files based on potentially incomplete keys

I want to merge two files like How to merge two files based on the matching of two columns? but one file may not have all results. So for example file1 1 dog 2 cat 3 fox 4 cow file2 1 woof 2 meow 4 ...
0 votes
1 answer
82 views

Incorrect overlapping of lines with Unix paste

I have one file called file1, which contains the following lines you are searching for a four . you are searching for a six . you are searching for a three . you are searching for an ace . you are ...
1 vote
0 answers
86 views

paste command with Variables instead of files

I have 3 variables , TITLES , SIZE and NUMBER. I want to concat them like so "NUMBER TITLE SIZE" This variables are multi line strings. eg: echo $NUMBER 1 2 3 ... I know that for files ...
  • 23
0 votes
0 answers
188 views

Combine .gz file with .tsv file (columns) using command line

I have two files. .gz file with with dimensions 12m x 5 columns .tsv file (no compression) with the same 12m rows and 9 more columns I normally would do this in R where I would read in both objects, ...
7 votes
1 answer
310 views

What is the correct way to merge two ASCII art files side by side while preserving alignment?

art_file (cat -A output): .::""-, .::""-.$ /:: \ /:: \$ |:: | _..--""""--.._ |:: |$ '\:.__ / .' ...
  • 519
0 votes
1 answer
158 views

create two new lines using paste command in bash

I'd like to paste three files into a single file with two spaces between each file using the paste command in linux bash: paste -d '\n\n' file1.txt file2.txt file3.txt > output.txt However, there ...
  • 23
0 votes
2 answers
66 views

How to merge two files of different number of lines using blank line condition?

I have two files, one have diffrent section separted by blank line as follows a11 a12 a13 b11 b12 b13 c11 c12 c13 a21 a22 a23 b21 b22 b23 c21 c22 c23 d21 d22 d23 a31 a32 a33 b31 b32 b33 the second ...
5 votes
4 answers
769 views

How to print multi-line variables in side-by-side columns in sh?

This question is based on a similar question on Ask Ubuntu, but instead of bash, I would like to have similar output in sh. No issue in bash; it works as expected. wolf@linux:~$ echo $SHELL /usr/bin/...
  • 1,301
1 vote
1 answer
37 views

merge x and x + n lines

I am writing a script which returns 15 lines of titles and 15 lines of URLs. title 1 title 2 title 3 *snip* title 14 title 15 http://example.com/query?1 http://example.com/query?2 http://example.com/...
0 votes
1 answer
225 views

How to to create a new file with specific columns from files in multiple folders in linux?

I have .tsv files in more than 100 directories. I want make a single file with all the information needed from all those tsv files in the 100 directories. For example: Data |___ SOB33D |___ ...
4 votes
3 answers
455 views

Fast version of paste

paste is a brilliant tool, but it is dead slow: I get around 50 MB/s on my server when running: paste -d, file1 file2 ... file10000 | pv >/dev/null paste is using 100% CPU according to top, so it ...
  • 30.7k
0 votes
3 answers
84 views

Linux one row from first file combine into multiple rows in second file, transpose denormalize

File_1 Group Country Lang IT USA ENG File_2 EMPID STOREID 1001 1400 1002 1401 1003 1401 If I use paste -d'\t' File_1 File_2 I get Group^ICountry^ILang^IEMPID^ISTOREID$ IT^IUSA^...
  • 3
2 votes
3 answers
354 views

Paste all files in directory column-wise by last modification order

I am looking to combine all files in a directory (each having one column) into a single file with multiple columns. However, I need the files to be pasted by last modification time order, i.e. in the ...
  • 21
1 vote
0 answers
192 views

can't copy screenshot in KDE/Debian 10

I have Debian 10 with KDE. Everything was working fine and suddenly today when I tried to copy a screenshot it didn't work. When I press the printscreen key, I get the popup showing the screenshot ...
  • 549
0 votes
1 answer
2k views

select rows based on specific column values [duplicate]

How can I select all rows in a text file based on different values of a particular column? The desired values are not in a specific interval. A short example of what I expect is given below. My data ...
0 votes
5 answers
208 views

How to "paste" two files without writing to a new file? [closed]

I am doing this for pathname in /user/home/file_*; do cat "$pathname" | sed -n '3p'; printf"\n"; done> user/home/foo; for pathname in /user/home/file_*; do cat "$...
1 vote
1 answer
2k views

sort multiple files and merge

I want to sort several text files in reverse order and then merge/cat to one single text file. a.txt 0 33.1 2 33.0 10 21.1 20 21.8 b.txt 0 30.1 2 33.0 10 28.1 20 27.8 and so on *.txt ...
2 votes
1 answer
143 views

Using tee and paste results in a deadlock

I am trying to redirect stdout of a command into two "branches" using tee for separate processing. Finally I need to merge results of both "branches" using paste. I came up with the following code for ...
1 vote
1 answer
102 views

How do I cut text from one file and replace it with text in another file?

I have a text file, mac.txt, with one line that looks like this: 4a:38:61:e1:71:7c ... and I have a bash script, mask.sh, that simply changes my MAC address: #!/bin/bash sudo ifconfig wlan0 down ...
2 votes
2 answers
133 views

Append a column to a file based on line number

I have a list of numbers which i would like to add to the end of another file as the final column: 1:.196 5:.964 6:.172 The numbers in front (1,5 and 6) indicate at which line the numbers have to be ...
  • 57
3 votes
2 answers
2k views

how can I slow down pasting text into a serial terminal?

I'm working on a raspberry pi, and trying to paste some text files into a command-line text editor nano... but the text ends up corrupted on the remote end (partial/incomplete text). I can only guess ...
  • 180
0 votes
1 answer
99 views

Paste: combine rows for each row, up to only the number of rows in the smallest row-ct file

Suppose I have two files, // foo a b c d // bar x,y,z p,d,q The problem is: paste -d ',' foo bar ... a,x,y,z b,p,d,q c d Instead, I would like to (somehow) produce the following: a,x,y,z b,...
  • 715
2 votes
2 answers
2k views

How to merge text files - Bash script

I want to write a script that takes text files as arguments and merge them. All the files consist of grouped lines divided by empty lines. The script can take more than 2 arguments The files can ...
  • 302
1 vote
4 answers
555 views

how to divide each one element from a column to each element of other column?

I have two column in one file : 1 2 3 5 4 8 9 18 3 5 4 19 I want to divide each element of first column to each element of second column and want to print that number too. for example: ...
2 votes
3 answers
212 views

How do I add numbers from two txt files and write it to the same file?

I want to add numbers from two txt files. The number will change in file1, and file2 should update itself like this file2 = file1 + file2. Decimals not needed. Example: file1 3 file2 7 Output: ...
0 votes
2 answers
51 views

Append file with two extra colums to a large table?

I need to paste two columns (in a file) to a very big file with an identical number of columns (length 48554). I have tried this I have two files with columns separated by tabs. File 1 looks like this:...
0 votes
1 answer
128 views

If I save file to my hdd (not ssd), move 2 trash, then cut /paste from trash to usb, will this hold up to forensic analysis designed to recover files?

If I save a file (.odt,.txt, jpeg, etc) to my hdd (not ssd), move to trash, then cut /paste the files in the trash to a usb, would this hold up to the best forensic equipment trying to recover the ...
3 votes
3 answers
85 views

regex from two files

I have two files that built of blocks of 4 lines, starting with a @. They are matching and in order. The files are too big (>10 GB) so I am putting here the first 3 blocks of each (12 lines). 1st: ...
1 vote
2 answers
71 views

How to make paste -d second file print down while looping?

I would like to make the second file label 'b' print down the first file label 'a', like shifting down the file creating new lines I want it to print all the way down until the first line of the ...
2 votes
1 answer
254 views

Paste & Brace Expansion vs Wildcard

Why does a brace expansion behave differently than wildcard in combination with paste? Example: Assume we have multiple folders, each containing the same-structured tsv and want to create a 'all.tsv' ...
  • 131
0 votes
1 answer
167 views

vim pastes onto completely wrong location

This has not just once, but happened many times. I'm not sure what I'm doing wrong.. it tends to occur more frequently during remote control. I would set the mouse cursor at a certain position where I ...
  • 103
0 votes
2 answers
58 views

Joining a standard output and susbtitution thereof into table

Say I have: $ cat tmp1.txt a b c Then $ paste tmp1.txt <(tr '[:lower:]' '[:upper:]'<tmp1.txt) a A b B c C How would I modify the above to 1/ invoke tmp1.txt only once? (I suspect tee)...
  • 501
2 votes
3 answers
790 views

Format output file from paste command

I have two or more files FileA A: 18.49 RPKM C: 14.49 RPKM B: 18.89 RPKM FileB A: 21.29 RPKM C: 38.71 RPKM B: 36.13 RPKM I want to paste these two files and print first-column ...
  • 105
0 votes
3 answers
64 views

Combining multiple columns and insert information in middle

I have to 3 files with all containing columns of information id.file 1 2 3 name.file Josh Kate Chris lastname.file Smith Jones Black And I would like to combine them in a way, so I can get ...
0 votes
0 answers
26 views

Merging two columns causes them to skip lines

I am trying to combine two text files each containing one column of numbers, I am using paste method to achieve this, but when I run my script it doesn't put them together correctly rather it skips a ...
1 vote
1 answer
319 views

Calculate difference in negative floating numbers with bc

I want to calculate the difference between two negative floating numbers and subsequently check if the result is below a certain threshold. The numbers are stored in the file.dat, since this ...
  • 167
0 votes
1 answer
64 views

how can I pass over a string on several txt files

I have a data like this but much bigger. So I have a df1.txt as follow sp|O15304|SIVA_HUMAN ...
  • 165
1 vote
2 answers
88 views

How do I align columns at common elements but give differing elements their own rows?

I am using paste to merge three text files (which do not require sorting) into a single document with three columns. paste a.txt b.txt c.txt I'd like elements that the columns have in common to ...
's user avatar
2 votes
3 answers
1k views

Why can't `paste` print stdin next to stderr?

Usually paste prints two named (or equivalent) files in adjacent columns like this: paste <(printf '%s\n' a b) <(seq 2) Output: a 1 b 2 But when the two files are /dev/stdin and /dev/...
  • 6,784
0 votes
1 answer
241 views

one-liner to delete a part of a column with matching pattern (sed/awk etc)

A very generic question but I am looking for the simplest way solve this very quickly and efficiently I have a file with a very large number of lines which looks like this 451267 sample1.txt ...
0 votes
2 answers
1k views

Copy line in text file and add modified line to the end of line in same file

I would like to copy line in text file edit it on the fly to replace all / to | and paste in on the same line in the same line. I have the first line in the text file: http://webpage.com/(name-never-...
  • 17
5 votes
3 answers
2k views

How to merge the different lines of files?

What is the fastest command line way to merge the different lines of files? For example, I have two files: a.txt: foo bar foobar b.txt foo foobar line by bar And I would like to get the ...
  • 153
1 vote
2 answers
842 views

How to transpose x and y axis of table, using cut & paste shell commands

I need to transpose x and y axis, of a file of 450.000 × 15.000 tab separated fields, so I tried first with a small 5 × 4 test file named A.txt: x column1 column2 column3 row1 0 1 2 row2 ...
  • 21
2 votes
3 answers
219 views

Giving a common path for a group of files into a bash script

The purpose of following script is to merge several tables and put them in an specific directory by using paste command. for i in {1..30} do paste ./directory"$i"/table1.txt table2.txt ... table20....
  • 67