Jon Aquino's Mental Garden

Engineering beautiful software jon aquino labs | personal blog

Wednesday, August 04, 2004

Useful unix commands

alias rgrep='find . ! -type d ! -type l | xargs grep'
find . -type f | xargs perl -pi -e 's/word1/word2/g'
find . -iname "*.bak" | xargs rm
grep "^[0-9]=[0-9]" Untitled.csp | cut -c 3- | sed -e 's/^/Warm /' - >> /cygdrive/c/sandbox/jump/jump/com/vividsolutions/jump/workbench/ui/renderer/style/ColorSchemes.txt
cp ColorSchemes.txt /cygdrive/c/sandbox/jump/jump/com/vividsolutions/jump/workbench/ui/renderer/style/
find /cygdrive/w/dev_run/jcs/scripts/jump-src-zip-contents/src -iname *.java | sed s#/cygdrive/w#w:# | ./cccc.exe --outdir=w:\\dev_src\\jcs\\documents\\development\\cccc\\jump --lang=java - &> /cygdrive/w/dev_src/jcs/documents/development/cccc/jump/cccc.log
find /cygdrive/w/dev_run/jcs/scripts/jcs-src-zip-contents/src -iname *.java | sed s#/cygdrive/w#w:# | ./cccc.exe --outdir=w:\\dev_src\\jcs\\documents\\development\\cccc\\jcs --lang=java - &> /cygdrive/w/dev_src/jcs/documents/development/cccc/jcs/cccc.log
find . -printf '%TY%Tm%Td-%TH:%TM %f\n' | sort
find . \( -iname '*.class' -o -iname '*.properties' -o -iname '*.ico' \) -print0 | xargs -0 jar cvf c:/junk3/d/lib/ext/ese.jar
find . -iname '*.java' | grep -v -i 'test' | grep -v -i 'geotools' | xargs grep -L 'For more information' | xargs -l1 c:/junk3/insert-header.sh

select E.NAME, A.NAME from ci_application_systems S, ci_app_sys_entities SE, ci_attributes A, ci_entities E
where S.ID = SE.APPLICATION_SYSTEM_REFERENCE
and E.ID = SE.ENTITY_REFERENCE
and A.ENTITY_REFERENCE = E.ID
and S.NAME = 'ADM'
and (INSTR(E.NAME, '_') <> 0 or INSTR(A.NAME, '_') <> 0)
order by S.NAME, E.NAME, A.NAME


perl -e'$i=@a=<>;while($i--){$j=int(rand($i+1));@a[$i,$j]=@a[$j,$i]}print@a' yourfile.txt

cvs export -rHEAD MODULE-NAME
cvs export -D "22 May 2002 12:00" MODULE-NAME

(defun array-to-coordseq (name)
(interactive "sArray Name: ")
(beginning-of-buffer)
(while (re-search-forward (concatenate 'string name ".toArray()") nil t)
(replace-match (concatenate 'string name) nil nil))
(beginning-of-buffer)
(while (re-search-forward (concatenate 'string name ".length") nil t)
(replace-match (concatenate 'string name ".size()") nil nil))
(beginning-of-buffer)
(while (re-search-forward (concatenate 'string name "\\[\\([^]]+\\)\\] = ") nil t)
(replace-match (concatenate 'string name".set(\\1), ") nil nil))
(beginning-of-buffer)
(while (re-search-forward (concatenate 'string name "\\[\\([^]]+\\)\\]") nil t)
(replace-match (concatenate 'string name".get(\\1)") nil nil))
)

#Search Martin's C++ source tree for references to graphic group
find . -iname '*.cpp' -o -iname '*.h' | xargs --max-lines=1 grep -i -H 'graphicgroup'

0 Comments:

Post a Comment

<< Home