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
  • You could use sed -n -e '1,15p' and sed -n -e 16,30p` to split your file prior to using paste.
    – waltinator
    Commented Dec 20, 2020 at 5:17

1 Answer 1

2

You're looking for the pr command

pr -2t -s" " file

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .