Linux / UNIX Tech Support Forum
This is a discussion on perl replace text within the CentOS / RHEL / Fedora forums, part of the Linux Distribution category; I am trying to remove this line OAS_AD('Top'); from html files find . -type f -name "*.html" | xargs perl ...
|
|||||||
| CentOS / RHEL / Fedora Discussion about Redhat Enterprise Linux or CentOS or Fedora Linux related problems. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
| Sponsored Links | ||
|
|
|
||||
|
I've not tested, but I trust jaysunn. One thing it should not be -pi~ -e
Code:
-pie
__________________
Vivek Gite Linux Evangelist |
|
||||
|
For Perl Use this:
Code:
for find in $(find . -type f -name "file1.html" ) ; do cat $find | perl -npe "s/OAS_AD\('Top'\);//g"; done
Tested and it seems to work. Code:
shine:~ jasonralph$ for find in $(find . -type f -name "file1.html" ) ; do cat $find | perl -npe "s/OAS_AD\('Top'\);//g"; done
<html>
<body>
<title>JAYSUNNS SUPER HTML PAGE<title/>
asdlasdlaasiodjoiasdjioasjdoasidjioasjd
ajsdopiaiospd
qowpdkopqkeopkqpwekopqwe
asdfopksdopfkopaskdfopkasopdfkopaskdfpoksdafk
asdfokaopsdfkopaskdfokaopsdf
asdfokaopsdfkopksadfkpoaksdpfokaspodfkpoaskdfpokasopdf
aosdkfopaskdfpokasofkpoaskfpokpafs
<body/>
<html/>
shine:~ jasonralph$
Jaysunn |
![]() |
| Tags |
| perl , perl -pie , perl replace text |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| To find and replace in text file | nashtech | Shell scripting | 5 | 31-01-2010 06:32 AM |
| How to list and replace file of same name in multiple paths | shchandu | Shell scripting | 1 | 27-08-2009 07:32 PM |
| shell script to find and replace a line using a identifier | kenray | Shell scripting | 1 | 11-05-2009 11:09 PM |
| Shell Script To change strings / text in a text file | jaysunn | Shell scripting | 1 | 08-05-2009 05:58 PM |
| How to replace a command in a file? | eawedat | Shell scripting | 2 | 20-08-2008 02:07 PM |