Tag: Perl
Replacing in Found Files
Replace one string by another in all file found by find. find . -name *whatyouwant* -exec perl -pi.bak -e ‘s/TEXT_TO_REPLACE/TEXT_TO_REPLACE_IT_WITH/g’…
Perl Joke
Just a joke – no offense intended… perl -e ‘a=”etbjxntqrdke”;a=~s/(.)/chr(ord(1)+1)/eg;printa’
Install CPAN in Fedora
If you are getting a ‘Can’t locate CPAN.pm in @INC’ error while opening cpan, you have not installed Bundle::Cpan. You…
Stop crond When mysqld is Down
A perl script to stop crond if mysqld is down #!/usr/bin/perl # See if MySQL server is alive or not…
git status Without the Untracked Files
Don’t show the untracked files in git status git status | perl -pe “exit if(/Untracked files\:/)”
Sensex Figure using a Linux Command
This one command will fetch and display the latest sensex figure in Linux. This command basically downloads a page, locates…
Command to Print Until Regular Expression
Print a file until a regular expression is matched. cat file.txt | perl -pe “exit if(/Thats all/)”
Remove empty directories
Remove all empty directories within the current directory find . -type d -empty -exec rmdir {} \; perl -MFile::Find -e”finddepth(sub{rmdir},’.’)”…
Replace \n with another String
The command to convert all \n in a file to another string – very useful for list code generation. perl…
Remove Extension in Shell Scripting
This command will list all the files a folder without their extensions. Comes handy when doing shell scripting perl -e…
Recent Comments