Skip to main content

Questions tagged [paste]

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

Filter by
Sorted by
Tagged with
2 votes
0 answers
80 views

The paste command is outputing tabs instead of new lines when used with process substitution

The first command below produces each number on a separate line, and I would expect the second command to do the same thing because the only difference between the two is that we are using echo '1 2 3'...
sudocracy's user avatar
  • 221
0 votes
2 answers
140 views

Side by side output from two `tail -f` commands

I have two scripts emitting single string to log files periodically that I need to tail -f and combine side by side for which I am using paste. This works but I am unable to pipe the output to another ...
Ketan's user avatar
  • 9,296
0 votes
0 answers
429 views

Copying all files and folders of a directory using tar

I am trying to copy my files from ssd to external hdd using linux live boot. The command I'm writing is: root@ubuntu:/media/ubuntu/4bd92f4b-6b48-4f4a-83ad-9d82d3be488b/home/pegasus# tar cf - Downloads ...
Zeshan Ahmed Nobin's user avatar
1 vote
0 answers
81 views

Pasting non-ascii (utf8) into remote urxvt terminal

For pasting text, in urxvt/rxvt-unicode one can use middle button to paste PRIMARY selection. I can do such Mouse-Middle-Click paste in my local urxvt terminal and even a remote server, in Chinese/...
xpt's user avatar
  • 1,644
5 votes
3 answers
965 views

Rounding many values in a csv to 3 decimals (printf ?)

I have a paste command like this paste -d , file1.csv file2.csv file3.csv And file2.csv contains numbers like this 0.2 0.3339 0.111111 I want the values in file2.csv having 3 decimals like this: 0....
R 9000's user avatar
  • 167
0 votes
3 answers
105 views

Combine .csv-files with different amount of lines

Here I asked already for a similar problem. Now I have 3 .csv-files but one of them has only 1 line. file1.csv dog cats mouse file2.csv 001a 002a 003c file3.csv WORD The output should be dog,001a,...
R 9000's user avatar
  • 167
1 vote
1 answer
72 views

Combine .csv-files with text between each line

I have two (or maybe more) files: file1.csv dog cats mouse file2.csv 001a 002a 003c If I use paste file1.csv file2.csv the output is dog 001a cats 002a mouse 003c Of course I can use paste -d ,...
R 9000's user avatar
  • 167
-2 votes
4 answers
79 views

How to keep previous and current line if the previous line contains common text?

How to keep previous and current line if the previous line contains common text? I have a main file like this: Hello_world Anna Frank Jeremy Hello_earth Jessie James I would want 3 output files like ...
jovicue's user avatar
  • 11
2 votes
3 answers
50 views

How to collect both full lines, and matching part of line?

Is it possible to output both the full line and the matched parts of some line? Suppose I have this input low [ 0]: 0xffff0000 Interesting description A hi [ 0]: 0xffff00a0 Interesting description B ...
Moberg's user avatar
  • 187
0 votes
5 answers
508 views

How to merge lines in groups of three

I have a file containing the below pattern, up to 2000 lines. For every group of three lines, the pattern repeats with different numerical values, but text values at the beginning are common up to ...
C S Pallapu's user avatar
-2 votes
2 answers
283 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 ...
Omar Maximo's user avatar
1 vote
1 answer
596 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 ...
topkek's user avatar
  • 61
2 votes
1 answer
385 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 ...
anndexi99's user avatar
2 votes
1 answer
421 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 ...
golimar's user avatar
  • 427
0 votes
2 answers
2k 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,...
Tap's user avatar
  • 25
0 votes
1 answer
450 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: ...
Iva l's user avatar
  • 1
5 votes
3 answers
349 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 ...
sadfasdfasdfddd's user avatar
0 votes
1 answer
234 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 ...
Ramón Wilhelm's user avatar
1 vote
0 answers
222 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 ...
Lampros's user avatar
  • 143
7 votes
1 answer
916 views

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

art_file (cat -A output): .::""-, .::""-.$ /:: \ /:: \$ |:: | _..--""""--.._ |:: |$ '\:.__ / .' ...
puwlah's user avatar
  • 519
0 votes
1 answer
410 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 ...
X3nion's user avatar
  • 33
0 votes
2 answers
87 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 ...
Mohsen El-Tahawy's user avatar
6 votes
4 answers
3k 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/...
Wolf's user avatar
  • 1,631
1 vote
1 answer
43 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/...
here's a name's user avatar
0 votes
1 answer
553 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 |___ ...
stack_learner's user avatar
4 votes
3 answers
804 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 ...
Ole Tange's user avatar
  • 35.8k
0 votes
3 answers
124 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^...
itsavy's user avatar
  • 103
2 votes
3 answers
709 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 ...
MSR's user avatar
  • 21
3 votes
1 answer
383 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 ...
raphael75's user avatar
  • 733
0 votes
1 answer
4k 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 ...
linux_lover's user avatar
0 votes
5 answers
347 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 "$...
user429870's user avatar
2 votes
1 answer
5k 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 ...
linux_lover's user avatar
2 votes
1 answer
196 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 ...
HollyJolf's user avatar
1 vote
1 answer
209 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 ...
noob_basher's user avatar
2 votes
2 answers
191 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 ...
Johnny's user avatar
  • 57
3 votes
3 answers
3k 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 ...
nmz787's user avatar
  • 190
0 votes
1 answer
195 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,...
Chris's user avatar
  • 983
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 ...
arty's user avatar
  • 302
1 vote
4 answers
833 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: ...
daizy123's user avatar
2 votes
3 answers
412 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: ...
machinecat's user avatar
0 votes
2 answers
97 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:...
Christoffer Bugge Harder's user avatar
0 votes
1 answer
190 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 ...
topencrypt's user avatar
3 votes
3 answers
226 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: ...
Hassan Massalha's user avatar
1 vote
2 answers
74 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 ...
Don Vito's user avatar
2 votes
1 answer
346 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' ...
iR0Nic's user avatar
  • 131
0 votes
1 answer
313 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 ...
dia's user avatar
  • 123
0 votes
2 answers
62 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)...
Erwann's user avatar
  • 667
2 votes
3 answers
1k 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 ...
CN_229133's user avatar
  • 115
0 votes
3 answers
107 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 ...
user222776's user avatar
0 votes
0 answers
42 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 ...
user222776's user avatar