Posts

Showing posts with the label Shell

An efficient way to transpose a file in Bash

awk  -F '  '                                                 #FS ' {     for (i=1; i<=NF; i++)  {         a[NR,i] = $i     } } NF>p { p = NF } END {        for(j=1; j<=p; j++) {         str=a[1,j]         for(i=2; i<=NR; i++){             str=str " " a[i,j];                            #OFS         }     ...

Shell command-line tools

General purpose command-line tools basename Extract just the filename from a filepath bc A calculator that reads from standard input cat Concatenates files together cd Change directory cp Copy files csvfix Parse CSV files curl Transfer a URL cut Cut out selected portions of lines date Print or parse date strings echo Print arguments to standard output grep Print lines matching a pattern head Print only the first few lines of a text stream history Show the last executed commands hostname Print the name of the computer you're currently on iconv Converts between character sets jq A command-line JSON parser kill Send a signal to a running process less Paginate long text streams ls List directory contents man Show documentation for a command mkdir Make a directory mv Move or rename files nano Interactive text editor printf Format and print data ps Show a snapshot of current processes pup Parse HTML from the ...