Home > Arb Unix Cmds > AUC #1: paste

AUC #1: paste

March 30th, 2009

auc2AUC 1 – Arbitrary Unix Command #1
I thought it might be useful to cover some obscure unix commands that you may find useful in your day to day system administration. My primary work machine is a Macbook Pro these days, so I’ll lean towards cover commands that come with OS X. Most unix operating systems (OpenBSD, FreeBSD, Linux, Solaris) will likely have the commands I cover as well so only the Microsoft-only folks will be left out. (sorry)

Up first is the command that took my 15 minutes to remember at work today when I wanted to take a list with one column and seperate it into a list with two columns. Here, a visual will make this easier to explain:

List of foo

This is a list of a person and their favorite fruit. You want to convert this into a table like this:

Useful lookup table

But your table is 100,000 lines long and you don’t want to do it by hand, or mess with any complex regular expressions in sed, awk or a scripting language.

The unix command paste does exactly this. Here’s how simple the syntax is:

cat 100k_file | paste – - > lookup_table

Now that’s pretty simple. Just change the number of “-”’s to how many columns you want.

paste can do some other things but this is how I found it to be useful. If you have another tip on paste, the comment box below awaits.

Related posts:

  1. AUC #2: ls AUC 2 – Arbitrary Unix Command #2 I thought it...
  2. Complete Unix Cron Job Crib Sheet Do you only use unix once in a blue moon,...
  3. Detecting bad TCP sessions Here’s an idea: Why not develop a feature into personal...
  4. alltop My RSS reader constantly has 1000+ entries left to read....

Arb Unix Cmds

Comments are closed.