Chapter 2: Command-Line Building Blocks
Activity 6: Processing Tabular Data – Reordering Columns
- The following commands are to be used in the given order:
robin ~/Lesson2 $ tail -n+2 land.csv | sort >sorted.txt robin ~/Lesson2 $ cat -n sorted.txt >numbered.txt robin ~/Lesson2 $ cat -T numbered.txt | head -n3 Â Â 1^IAfghanistan,AFG,1961,57.7459179609717 Â Â 2^IAfghanistan,AFG,1962,57.8378212786815 Â Â 3^IAfghanistan,AFG,1963,57.914407376773 robin ~/Lesson2 $ tr ',' '\t' <numbered.txt >tabbed.txt robin ~/Lesson2 $ cat -T tabbed.txt | head -n3 Â Â 1^IAfghanistan^IAFG^I1961^I57.7459179609717 Â Â 2^IAfghanistan^IAFG^I1962^I57.8378212786815 Â Â 3^IAfghanistan^IAFG^I1963^I57.914407376773 robin ~/Lesson2 $ join -o1.4,1.5,1.3 tabbed.txt tabbed.txt >342.txt robin ~/Lesson2 $ join -o1.5,1.4,1.2 tabbed.txt tabbed.txt >431.txt
- To view the expected content in the two output files, use the following...