>_ IzzyLab

Hands-on task

This task is step 5 of the course “Text in the terminal: grep, sed, awk”

Merge files by columns

easy~3 min

There are two files of the same length: /root/names.lst (names) and /root/emails.lst (emails), one entry per line. Merge them line by line into two columns separated by a tab (name, then email) and write to /root/contacts.tsv.

What you'll practise:
  • paste
  • column merging
  • tab
  • tsv

Topic breakdown

paste joins files side by side rather than one after another: it takes one line from each supplied file and glues them into a single line, separating them by default with a tab. The order of the columns in the output follows the order of the files in the arguments. This is handy when parallel lists of the same length need to be combined into a table.

What's checked

  1. columns joined with a tab
  2. all records joined

What it looks like