Random Commands

grep -oE "flagF{.*}"

       -o, --only-matching
              Print  only  the matched (non-empty) parts of a matching line, with each such part on a separate output line.

       -E, --extended-regexp
              Interpret PATTERNS as extended regular expressions (EREs, see below).
# bc: basic calculator

$ echo "scale=2 ; $TOTAL_DST / $TOTAL_FILES" | bc

$ bc <<<"scale=2; $var1 / $var2"

$ echo "12+5" | bc
17
# jq for json manipulation

$ TOTAL_FILES=$(cat incidents.json | jq '.[][] .file_hash' | tr -d '"' | sort | uniq -c | wc -l)
$ TOTAL_DST=$(cat incidents.json | jq '.[][] .ticket_id' | tr -d '"' | sort | uniq -c | wc -l)

Last updated

Was this helpful?