I'm looking for a solution for the following simple problem. I have two files, fileA and fileB. Each file contains only one word per line, and they contain exactly the same number of lines. I would like to create a new file called fileAB, where the i-th line contains the i-th line of fileA, a Tab separator character, and then the i-th line of fileB. I know how to do it in Python or other scripting languages, but it would be nice to have a bash one-liner for that. Is it possible to do this in bash or any other Unix shell, using the tools that are usually available on the command line (e.g., sed, awk and such)?

link|improve this question
Ignacio's answer is of course excellent, but it's worth mentioning that python is availbable on the command line and is in principle no less of a "one liner" than sed or paste. – CarlF Oct 21 '10 at 18:03
feedback

1 Answer

up vote 9 down vote accepted

You want paste.

paste fileA fileB > fileAB
link|improve this answer
Yay, that's exactly what I was looking for. Thanks! – Tamás Oct 21 '10 at 15:35
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.