Skip to content

Instantly share code, notes, and snippets.

@shawnkendrick
shawnkendrick / commonly used but often forgotten
Last active March 8, 2023 17:52
commonly used but often forgotten
# combine, sort and combine all files in a directory into single file
cat dir/*.csv | sort -u > output.csv
# add character to front of every of every line in a file
sed 's/^/#/' file.txt
# combine multiple CSVs, exclude all but first header
awk 'FNR==1 && NR!=1{next;}{print}' *.csv > combined.csv
* recursive grep, exclude a directory
grep -R -l --exclude-dir=examples 'meh' .
* recursive grep, exclude mutliple directorie & files
grep -r --color --exclude-dir={custom,lib,scripts} --exclude={*.xml,error_log} "beta" .
* find
find . -name *.jpg
* port activity