Questions tagged [paste]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
30 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
35 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
26 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 ...
1
vote
2answers
53 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
19 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
113 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
73 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
122 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 ...
0
votes
1answer
69 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
48 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
68 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
65 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

Combining files by column-paste does not work as intended

I'm trying to combine files together to use in R using terminal since I cannot do it in R due to limit in RAM size. I tried using something like paste * > file using smaller test files so I ...
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
49 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
172 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
131 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
72 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
468 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
37 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
83 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
842 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
367 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
71 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
501 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
56 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
44 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
210 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
41 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
232 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
72 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
514 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
193 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
273 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
667 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
1k 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
4k 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
857 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 ...
0
votes
2answers
1k views

Append first column to file

I have a file that looks like this: Heading1,Heading2 value1,value2 And another one that looks like this: Row1 Row2 How can I combine the two to become: Row1,Heading1,Heading2 Row2,value1,value2 ...
1
vote
1answer
60 views

Horizontally concatenating periodically

I have 2 files namely f1 and f2. File f1 keeps getting new output periodically in the form $cat f1 a b c After "x" seconds $cat f1 e f g After "2x" seconds $cat f1 h i j and so on. ...
0
votes
1answer
51 views

Strange behavior of paste [closed]

I am experiencing some strange behavior of the paste tool. For some reason it appears to not do it's job on two specific files, but I cannot reproduce that behavior with other files. The first file: ...
1
vote
1answer
1k views

how to add output as a new column with the file names

How can I add output of each file incrementally in one singel output? I want to do this instead of running paste command on all files together. It is because I have 10k files and each file is 100 GB ...
0
votes
1answer
394 views

When do you need “…|while read…”?

I saw a video tutorial for the paste command, in which three files foo,bar,baz were connected horizontally with a "+" sign between. cat foo 51 33 67 cat bar 10 1 13 cat baz 7 100 15 So, he used a ...
1
vote
2answers
93 views

How can I paste files with the same name from different directories?

I have another question. I have three different directories but I have the same files inside, with the same name. For example: Directory1: dir1/file1.txt dir1/file2.txt dir1/file3.txt Directory2: ...