Category: AP
bash – awk if then else snippet
A clear example of the if/then/else structure formatting in awk. 123456789$ awk ‘ BEGIN { FS="," ; FORMAT="%-10s%-8s%s\n" ; {printf FORMAT,"A","B","% age"} } { … Read More
bash – df to get space usage by volume
1234567891011#display current Volume in 1024-byte blocks df -k . #display ALL Volumes in megabytes df -m #display /home Volume in gigabytes df -g /home #display ALL Volumes … Read More
bash – pass arguments with flags to script
Pass arguments in any order, with ability to have some of the flags optional: 12345678910while getopts u:d:p:f: option do case "${option}" in u) USER=${OPTARG};; d) DATE=${OPTARG};; p) PRODUCT=${OPTARG};; f) FORMAT=${OPTARG};; … Read More
moreutils: the utilities package every UNIX/Linux/Mac OS developer should know
SOURCE: CLEAN CODING Amazing additions to the cli toolset: combine – combine lines in two files using boolean operators AND NOT OR XOR ifdata – ifconfig with simple to parse … Read More
bash NULL DEVICE – redirecting output & errors
source simpleit.rocks descriptors: stdin: 0 stdout: 1 stderr: 2 1>/dev/null ## Redirect OUTPUT (stdout) to null 2>/dev/null ## Redirect ERRORS (stderr) to null &>/dev/null ## Redirect OUTPUT and ERRORS (stdout … Read More