Questions tagged [paste]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
22 views

Passing directory path as arguments and extract columns from files to make a new file with horizontal concatenation

I need a shell script which takes in the path of directories as arguments. The directory contains similar named files for eg. file1.dat, file2.dat etc. I need to take file1.dat from all the ...
0
votes
1answer
39 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
5answers
75 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
1answer
77 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 ...
0
votes
0answers
23 views

How to stop random pasting in Pop!_OS?

I recently installed and began using Pop!_OS 20.04 LTS on my Lenovo ThinkPad T460p. The desktop environment is GNOME 3.36.3 and windowing system is X11 (the defaults). I am experiencing random pastes ...
0
votes
0answers
35 views

Copy and paste a folder

I am trying to make a copy of an OpenFoam tutorial folder to my desktop through Ubuntu since I don't want to mess up the original files. I use the command line: cp -r $FOAM_TUTORIAL /mnt/c/Users/...
2
votes
1answer
55 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 ...
0
votes
0answers
32 views

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

So 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
2answers
41 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 ...
-1
votes
1answer
36 views

How to use cut to create a single file with required columns from multiple files in linux

I have estimate.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. The data in estimate.tsv file looks ...
3
votes
2answers
286 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
1answer
23 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
2answers
342 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
4answers
128 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
3answers
123 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
2answers
33 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
1answer
76 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
3answers
55 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
2answers
69 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 ...
1
vote
1answer
104 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
0answers
28 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
2answers
51 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
3answers
315 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
3answers
52 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
0answers
23 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 ...
0
votes
1answer
193 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 ...
0
votes
1answer
59 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 ...
1
vote
2answers
75 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 ...
3
votes
3answers
606 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/...
0
votes
1answer
39 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
2answers
170 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-...
4
votes
3answers
991 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 ...
1
vote
2answers
482 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 ...
2
votes
3answers
98 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....
0
votes
2answers
667 views

Git-bash UNIX: Switch columns/fields using cut?

So I have a file with 2 columns as follows: 10 1 11 2 12 3 13 4 14 5 I would like to switch the columns using the cut command. I've used paste <(cut -f2 file.dat) <(cut -f1 ...
1
vote
0answers
116 views

Paste contents of many files together within a vi bash script [duplicate]

I cannot seem to get a paste command to work in a bash script. The command pastes the contents of a range of files together and outputs a new combined file. This is what works outside the script if I ...
0
votes
2answers
45 views

Formatting columns of an output text [duplicate]

I have 3 files file1: compute-0-44 compute-0-2 compute-0-7 compute-0-8 file2: 0 11/29/2017 | 02:01:34 0 05/16/2018 | 08:47:56 file3: 0 963 0 459 When I do paste file1 file2 file 3, I get : ...
1
vote
1answer
248 views

how to copy and paste only a specific column in each file?

I have nearly 400 files, each looks like this: head HI.1.Q091_13R_all_PA_code Ha8_00040788 C Ha4_00024045 C Ha4_00025366 C Ha16_00022130 C Ha16_00023451 C Ha8_00040789 C Ha4_00025367 C Ha4_00024046 A ...
1
vote
0answers
43 views

Removing ^M from shell script and realigning columns

I have a shell script that I am asking to print the columns I pasted together. Then I'm asking it to realign the columns after its pasted and then take out the ^M character . My code is paste ...
0
votes
1answer
328 views

Create header to table from the output of the command “paste”

I have folder (data) contain large number of text files. Each text file contain one column of numbers, the column contain 30 numbers. I want to create table that combine the columns in these text ...
0
votes
1answer
78 views

pasting files in unix

I have a folder with multiple files: W1747_RH_sig_window_outliers_g_chrom W1747_RH_sig_window_outliers_g_pos W1747_RH_sig_window_snps_g_chrom W1747_RH_sig_window_snps_g_pos ...
3
votes
3answers
549 views

How to parse input file once and send to two separate streams and display side-by-side?

I've got the following script: #!/usr/bin/env bash # Script to generate MD5 hash for each line. [ $# -eq 0 ] && { echo "Usage: $0 file"; exit 1; } file=$1 shopt -s expand_aliases alias ...
0
votes
0answers
37 views

Inconsistent “paste” executable behavior

To start, apologies if this is addressed somewhere already. Because of the name of the executable, my search results weren't relevant. Anywho, I'm using "paste" on Ubuntu to seam several text files ...
1
vote
2answers
327 views

How to combine alternate lines in a file?

I have a 4 line input file and i need to modify the file to combine alternate lines. I want to perform the operation in place. INPUT: Tom Nathan Jack Polo Desired Output: Tom Jack Nathan Polo ...
3
votes
4answers
360 views

How to make `paste` command stop on shortest file

I have two files: a.txt 1 2 3 b.txt foo bar baz qux Running paste a.txt b.txt gives 1 foo 2 bar 3 baz qux However I want to stop when the shortest file ends (that is, I want to print only ...
2
votes
3answers
926 views

How to print the second column of many files?

I have more than 10 files, the 1st column is the same in all files, I need to collect all the columns 2 in all files against the 1st column in one file. I tried with paste then awk but this print only ...
3
votes
4answers
2k views

Combine list of words into one line, then add characters

I want to take a file that has a list of words on each line of its own eg. act bat cat dog eel and put them into one line with comma separated and quoting them. So that it turns out like: 'act', '...
2
votes
2answers
7k views

How to join files with required columns in linux?

I have many files like following in a directory "results" 58052 results/TB1.genes.results 198003 results/TB1.isoforms.results 58052 results/TB2.genes.results 198003 results/TB2.isoforms.results 58052 ...
4
votes
4answers
6k views

Print two files in two columns

I want to print two files in two columns -- first file on the left side and second on the right side. paste doesn't do the job, since it can only insert a character as delimiter. If first file has ...
1
vote
2answers
1k views

how to paste several file together using a single space as a delimiter [duplicate]

These are 3 files: file1 file2 file3 1 2 3 1 1 1 3 3 3 2 1 3 1 1 1 3 3 3 0 0 0 1 1 1 3 3 3 I want to join them together and have a final file like: 1 2 3 1 1 1 3 3 3 2 1 3 1 1 1 3 3 ...