Academic Work Personal
|
Perl /
Perl as a command line utility
QuestionHow to replace Examples$ perl -e 'print "Hello, World!\n"' Hello, World! The $ echo laci | perl -ne 'if (/a/) { s#a#A#; print; }' lAci $ echo hello | perl -ne "s/h/H/; print;" Hello $ echo hello | perl -pne "s/h/H/" Hello The option $ echo file.ext | perl -npe "s|\.(.*)$||" file Remove file extension. Note: don't use jabba@hoth:~$ FILE=file.ext jabba@hoth:~$ echo $FILE file.ext jabba@hoth:~$ FILE=`echo $FILE | perl -npe "s|\.(.*)$||"` jabba@hoth:~$ echo $FILE file Manipulate shell variables (as strings) with Perl in command line. More examples |
![]() anime | bash | blogs | bsd | c/c++ | c64 | calc | comics | convert | cube | del.icio.us | digg | east | eBooks | egeszseg | elite | firefox | flash | fun | games | gimp | google | groovy | hardware | hit&run | howto | java | javascript | knife | lang | latex | liferay | linux | lovecraft | magyar | maths | movies | music | p2p | perl | pdf | photoshop | php | pmwiki | prog | python | radio | recept | rts | scala | scene | sci-fi | scripting | security | shell | space | súlyos | telephone | torrente | translate | ubuntu | vim | wallpapers | webutils | wikis | windows Blogs and Dev. * Ubuntu Incident Places Debrecen | France | Hungary | Montreal | Nancy Notes Hobby Projects * Jabba's Codes Quick Links [ edit ] |