Cheatsheet for miscellaneous GNU utils. makefile, paralell, date.
For bash look for shells, for awk here.
Makefile
Variables
# Indent with TABS!
foo = ala
build:
gcc $(foo)
Conditionals (ifs)
# Indent with TABS!
down:
@if command -v podman ; then\
podman stop container; \
else \
docker stop container; \
fi
Parallel
Parallel - process data stream in parallel using a program / script. Sem - do the same for bash functions. Examples:
# Parallel
fd text_structure.xml .. | parallel --no-notice --pipe -j 6 --block 1M ./convert.sh
# Sem
stage2() {
# Some work
}
export -f stage2
for file in ./data/joined/*; do
sem -j 7 stage2 $file ${file/joined/stage2}
done
Date
Formatting: TOC, Conversion specifiers
Comments