Unix / Linux

Saturday, June 09, 2012

Install maven 3 on ubuntu linux

179 sudo apt-get search maven 180 apt-cache search maven 181 apt-cache search maven3 182 cd ~ 183 ls 184 pwd 185 cd /opt 186 ls 187 wget http://ftp.heanet.ie/mirrors/www.apache.org/dist//maven/binaries/apache-maven-3.0.4-bin.tar.gz 188 tar xvfz apache-maven-3.0.4-bin.tar.gz 189 mkdir /usr/local/apache-maven 190 cp -R apache-maven-3.0.4 /usr/local/apache-maven/ 191 sudo nano /etc/environment 192 vi /etc/environment 193 mvn 194 echo $PATH 195 logout 196 echo $PAT 197 echo $PATH 198 echo $MAVEN_HOME 199 vi /etc/environment 200 logout 201 mvn 202 mvn --version

Wednesday, September 10, 2008

one line perl search replace

current directory

perl -p -i -e 's/oldstring/newstring/g' *

recursive

perl -p -i -e 's/oldstring/newstring/g' `find ./ -name *.html`

do the replace only on flies we know to contain the original string

perl -p -i -e 's/oldstring/newstring/g' `grep -ril oldstring *`

Monday, June 23, 2008

search replace multiple files, recursive

find . -type f -name "*.txt" -exec sed -i 's/oldstring/newstring/g' {} \;

Tuesday, June 10, 2008

total number lines of code wc -l

find . -type f -name "*.java" -exec cat {} \; | wc -l

find number of lines of code

find . -type f -name "*.java" -exec wc -l {} \;

Sunday, May 04, 2008

make environment variables linux permanent

edit:
/etc/profile and add to there the environment variables (with export)

Sunday, April 13, 2008

unzip grep

unzip -p '*.zip' | grep IllegalAnnotationExceptions

Tuesday, April 08, 2008

linux search replace

Substitution sed -i 's/<oldstring>/<newstri ng>/g' <file>
-i means in place, without it the file wont be updated
Deletion sed '<start>,<end>d' < file>

perl -pi -w -e 's/search/replace/g;' *.txt