Command Line Exercises
Contents
Command-line Exercises
Many of these are so called throwaway one-liners
In each of these examples we show the finished one-liner first, and then proceed to build it up
Extract columns from files held in differenrt subfolders
We shall run a for-loop in the shell environment and execute an awk column-selecting command for a certain file called report.tsv
Finished Command
for i in $(ls -d */); do S=$(echo ${i%/*}); export S; \ awk '{if(NR!=1){if($19 != ".") {system("./echon.sh $S"); printf "\t%s\t%s\t%s\t%s\t%s\n",$2,$15,$17,$19,$20}}}' \ ${i}report.tsv;echo; \ done >a.xls