Perlify your command line

I'm not a Perl expert, not even someone who know how to actually program in Perl. So please don't expect anything miraculous about Perl coming through my keyboard. I happen to prefer PHP or AWK personally, but I respect Perl very much. And sometimes, even recently, it has saved my life.

The directory tree of a big server changed and I needed to update outdated path details in some hundreds configurations files.

Usually I do this using sed, but this time I was on a system without any GNU sed available:

[oswald@solaris10 ~] cat life
My life is so bad!
[oswald@solaris10 ~] sed -i 's/bad/good/g' life
sed: illegal option -- i

In this case Perl was my life saver:

[oswald@solaris10 ~] perl -pi -e 's/bad/good/g' life
[oswald@solaris10 ~] cat life
My life is so good!

Thank you, Perl.

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

Kai 'Oswald' Seidler writes about his life as co-founder of Apache Friends, creator of XAMPP, and technology evangelist for web tier products at Sun Microsystems.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today