1

I am writing a script which returns 15 lines of titles and 15 lines of URLs.

title 1
title 2
title 3
*snip*
title 14
title 15
http://example.com/query?1
http://example.com/query?2
http://example.com/query?3
*snip*
http://example.com/query?14
http://example.com/query?15

I'd like to merge it in such a way that produces the following output:

title 1 http://example.com/query?1
title 2 http://example.com/query?2
title 3 http://example.com/query?3
*snip*
title 15 http://example.com/query?15

Upon light inspection and the guidance of this answer, I found the command paste. However, paste does not allow for the performance of more complex behaviors like the ones described above. Is there another tool or combination of tools I can use in order to accomplish the aforementioned behavior?

Do note that I'm looking to use all standard coreutils behavior, if at all possible.

1 Answers1

2

You're looking for the pr command

pr -2t -s" " file
glenn jackman
  • 84,176
  • 15
  • 116
  • 168