Questions tagged [paste]
The `paste` utility merges corresponding or subsequent lines of files.
134
questions
0
votes
2
answers
50
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 ...
0
votes
0
answers
39
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 ...
1
vote
0
answers
33
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/...
5
votes
3
answers
772
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....
0
votes
3
answers
85
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,...
1
vote
1
answer
59
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 ,...
-1
votes
2
answers
57
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 ...
2
votes
3
answers
44
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
...
-2
votes
5
answers
210
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 ...
-2
votes
2
answers
213
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
421
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 ...
2
votes
1
answer
296
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
328
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 ...
0
votes
2
answers
1k
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,...
0
votes
1
answer
301
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:
...
4
votes
3
answers
324
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
192
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
184
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 ...
7
votes
1
answer
649
views
What is the correct way to merge two ASCII art files side by side while preserving alignment?
art_file (cat -A output):
.::""-, .::""-.$
/:: \ /:: \$
|:: | _..--""""--.._ |:: |$
'\:.__ / .' ...
0
votes
1
answer
326
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 ...
0
votes
2
answers
80
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 ...
6
votes
4
answers
2k
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
vote
1
answer
39
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
484
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
657
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 ...
0
votes
3
answers
112
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^...
2
votes
3
answers
600
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 ...
3
votes
1
answer
280
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 ...
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 ...
0
votes
5
answers
331
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 "$...
2
votes
1
answer
4k
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
175
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
185
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
175
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 ...
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 ...
0
votes
1
answer
182
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,...
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 ...
1
vote
4
answers
759
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
367
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
84
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
178
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
179
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
73
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
323
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' ...
0
votes
1
answer
247
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 ...
0
votes
2
answers
60
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)...
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 ...
0
votes
3
answers
98
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
34
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
409
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 ...