paste files without delimiter

How do I join two files vertically without any separator? I tried to use paste -d"" a b, but this just gives me a.

Sample file:

000    0   0   0
0001000200030004
  10  20  30  40
    2000    4000
            .123
            12.1
1234234534564567

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

paste use for null delimiter as defined by POSIX:

paste -d'' file1 file2

Using -d"" a b is the same as -d a b: the paste program sees three arguments -d, a and b, which makes a the delimiter and b the name of the sole file to paste.

If you’re on a GNU system (non-embedded Linux, Cygwin, …), you can use:

paste -d "" file1 file2

The form -d "" is unspecified by POSIX and can produce errors in other platforms. At least BSD and heirloom paste will report no delimiters error.

Method 2

The solution is:

paste -d "" a b


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x