|
|
|
|
UGU: Unix Guru Universe - Unix Tip #4187- July 29, 2012
- Home : Help
: Today's Tip
Unix Tip #4187- July 29, 2012
PERL FIND AND REPLACE
In UNIX environment, the
following combination of perl
and find will serch for a
particular file and replace
the occurence of a particular
string with another string in
that file. This will also
work for multiple files and
directories. The find
command finds the file and
the perl script replaces
old string with the new one.
At the command prompt give
this command:
# perl -pi -e 's//' `find . -name ""`
NB: Perl should be in the
path and the general regular
expression rules apply while
using special characters
for eg / or .
This tip generously supported by: pandpr@dh.cit.alcatel.fr
NOTE: All tips provided are USE AT YOUR OWN RISK. Tips are submitted
by various unix admins around the globe. UGU suggest you read and
test each tip in a non-volitile environment before placing into
production.
LAST 5 TIPS
4186
- BE ALARMED
4185
- NUMBERING A FILE
4184
- BACKING UP FILES
4183
- SNEAK THE EDUCATION IN
4182
- MANIPULATE MULTIPLE FILES
I want to
SUBSCRIBE
and get a UGU Tip everyday.
I want to
UNSUBSCRIBE
and NOT get a UGU Tip everyday.
If you have a UNIX TIP let us know, we just may use it:
(All tips become the property of the Unix Guru Universe)
|
|
|
Copyright 1994-2024 Unix Guru Universe |
|
|
|
|