Suppose you have a bash script that wants to pass a value to an awk line. You would do something like this: 1awk -v today="$(date)" 'BEGIN {print today}' Key above is the -v in awk which can be repeated as there are variables to assign. See man awk for details. If you put it into the awk body, (outside …
Read MoreAssume that you have a column of data and you want to separate each column into it's own file. It's relatively easy in awk. Input is a sha256 or hash of ebooks: 1~$ sha256sum *.pdf 29scac1ae26617a210e2211cce308aa2b770b08cb51f46621b13be272877cc068 ebook1.pdf …
Read MoreThis swaps every two lines of input. Given this input.txt 1wan 2tew 3free 4phore Ouput the following: 1tew 2wan 3phore 4free Full command to run: 1~$ cat input.txt | awk '{ 2if ((getline tmp) > 0) { 3print tmp 4print $0 5} else 6print $0 7}' CREDITS: https://www.math.utah.edu/docs/info/gawk_6.html
Read Morehttps://unix.stackexchange.com/questions/44040/a-standard-tool-to-convert-a-byte-count-into-human-kib-mib-etc-like-du-ls1
Read More