This extends upon https://devhints.io/bash
Version | When | Who | What |
---|---|---|---|
1.0.0 | 2020-09-02 | Viet Yen Nguyen | First version |
Replace part
$ export FOO=`echo "foo" | sed -e s/oo/ee/g`; echo $FOO
fee
Get column by delimiter
$ export FOO=`echo "foo,bar" | cut -d , -f 2`; echo $FOO
bar
Filtering strings
curl -s https://api.hypefactors.com/v2/categories | jq -r | grep id
Filtering strings from files recursively
egrep -rH needle *
Pretty print
curl -s https://api.hypefactors.com/v2/categories | jq
Get element(s) then as CSV
curl -s https://api.hypefactors.com/v2/categories | jq ".data[] | [.id, .name] | @csv"
Over files
for FILE in `find .`
do
md5sum $FILE
done
Infinite (e.g. for monitoring)
while [ true ]
do
echo "awake"; sleep 5
done
Please add grep cheatsheet too