Skip to content

Instantly share code, notes, and snippets.

@zinking
Last active December 31, 2015 21:58
Show Gist options
  • Save zinking/8049902 to your computer and use it in GitHub Desktop.
Save zinking/8049902 to your computer and use it in GitHub Desktop.
ksh wrapper
T=$(grep -i "Message received:" $F | wc -l)
typeset -F2 MP=$M.00/$T.00 #float number calculation
printf "Total[%8s] [%8.2f]"
#meaning escalate all warnings like 0 rows
set -e
tr '\n' ' ' | sed s/.$//' '
grep -i "message" `find 2014* -type f -name *.log` | wc -l
#maxdepth 1 restrict the serach to current folder
#put path first
find . -maxdepth 1 -type f -empty -exec rm {} \;
sort | uniq -c #count the uniq sets
awk -F . '{if (NF>1) {print $NF}}' #extract file extension
find $PWD -name "*.ksh" -exec ksh -n {} \;
find $PWD -name "*.sh" -exec ksh -n {} \;
#ln -nsf <target path> <symbol>
find $PWD -name "*.pl" -exec perl -c {} \;
find $PWD -name "*.py" -exec python -m py_compile {} \;
# -e: aborts on error, no snowballing
# -u: aborts if a value is uninitializaed
# -o pipefail: aborts if caommand fails within a pipe
# set -e -u
#some useful sample commands
find . -regex "*.Db\.java"
find . -name "*.java" -exec grep -n -H "new .*Db.*" {} \;
#-n show line number -H show file name
svn st | grep '^\?' | tr '^\?' ' ' | sed 's/[ ]*//' | sed 's/[ ]/\\ /g' | xargs svn add
#mark the svn ? files as added
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment