Similar to
Append one column from fileB onto end of FileA and bash cut columns to one file and save onto the end of another file
However, the methods presented by the answers to the questions above do not seem to work with my files on my machine. See the paste
errors below.
Background // I have two tab-delimited files (both with 3 columns):
$ cat file1.txt
4481679 4481722 .
4481791 4481820 .
4481947 4482268 .
$ cat file2.txt
13368 - 366
13668 + 940
14016 - 270
Desired output // I want to merge/append the second column of file2.txt to file1.txt (output file has 4 columns):
$ cat file1.txt
4481679 4481722 . -
4481791 4481820 . +
4481947 4482268 . -
Attempts //
# Attempt1:
$ paste file1.txt <(cut -f2 file2.txt) >> file1.txt
# Attempt2:
$ cut -f2 file2.txt | paste file1.txt - >> file1.txt
# Attempt3:
$ paste file1.txt <(awk '{print $2}' file2.txt) >> file1.txt
After trying any of the above commands, the following error is returned:
paste: write error: No space left on device
paste: write error
Any ideas how I can get this to work without using sponge
from moreutils (i.e., using only things like paste
, cut
, awk
, sed
)?