From carnold@electrichendrix.com Sun Nov 11 00:40:48 2007 From: Chris Arnold To: users@lists.opensuse.org Subject: [opensuse] OT: Need program to replace text Date: Sat, 10 Nov 2007 19:41:44 -0500 Message-ID: <30446637.11194741704528.JavaMail.root@mail> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8795721631922275600==" --===============8795721631922275600== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable I have a bunch of html files that i need to do a couple of things to: 1.remove the html and head tags and replace them with other code 2.rename the file to .php Isn't there a program that will search all the files in a given directory for= html and head and then replace that with something else? Then rename the fil= es? I have seen the replace function in gedit but it does not accept the php = code that needs to be inserted (i think the code is to long). Anyone no of a = program/way that will accomplish this? --=20 To unsubscribe, e-mail: opensuse+unsubscribe(a)opensuse.org For additional commands, e-mail: opensuse+help(a)opensuse.org --===============8795721631922275600==-- From michael@michael-skiba.de Sun Nov 11 00:51:08 2007 From: Michael Skiba To: users@lists.opensuse.org Subject: Re: [opensuse] OT: Need program to replace text Date: Sun, 11 Nov 2007 01:50:47 +0100 Message-ID: <200711110150.52252.michael@michael-skiba.de> In-Reply-To: <30446637.11194741704528.JavaMail.root@mail> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8731149287065545181==" --===============8731149287065545181== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Am Sonntag, 11. November 2007 01:41:44 schrieb Chris Arnold: > file to .php > > Isn't there a program that will search all the files in a given directory > for html and head and then replace that with something else? Then rename > the files? I have seen the replace function in gedit but it does not accept > the php code that needs to be inserted (i $ sed -i 's/red/blue/g' file to replace every entry called red with one that's called blue and write it in the file(-i). You can of course use such things as ./* for the hole directory.... man sed or man awk will provide you with further informations :) Greetings Michael --===============8731149287065545181== Content-Type: application/pgp-signature Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="signature.asc" MIME-Version: 1.0 LS0tLS1CRUdJTiBQR1AgU0lHTkFUVVJFLS0tLS0KVmVyc2lvbjogR251UEcgdjEuNC41IChHTlUv TGludXgpCgppRDhEQlFCSE5sSHNjSHdiVy96bE9ab1JBbWplQUo5ZW5jd0NJdGFwT25tWFJKWEQ2 Z1p3NmhzWlJnQ2RFMW1FClRGalJuMDN5b1hrMVNIYUNQZWIwTWZRPQo9VmxZMgotLS0tLUVORCBQ R1AgU0lHTkFUVVJFLS0tLS0K --===============8731149287065545181==-- From carnold@electrichendrix.com Sun Nov 11 02:27:01 2007 From: Chris Arnold To: users@lists.opensuse.org Subject: Re: [opensuse] OT: Need program to replace text Date: Sat, 10 Nov 2007 21:27:54 -0500 Message-ID: <16337745.41194748074449.JavaMail.root@mail> In-Reply-To: <200711110150.52252.michael@michael-skiba.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6595162579463327210==" --===============6595162579463327210== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable $ sed -i 's/red/blue/g' file to replace every entry called red with one that's called blue and write it in= =20 the file(-i). You can of course use such things as ./* for the hole=20 directory.... man sed or man awk will provide you with further informations :) I have a long replacement text like this:
and the text that needs to be replaced is: Net Bible - Genesis

So the command i run looks like this; sed -i 's/Net Bible = - Genesis

/

/g' ./* and i get this error: sed: -e expression #1, char 99: unknown option to `s' --=20 To unsubscribe, e-mail: opensuse+unsubscribe(a)opensuse.org For additional commands, e-mail: opensuse+help(a)opensuse.org --===============6595162579463327210==-- From akulkis00@hotpop.com Sun Nov 11 03:40:37 2007 From: Aaron Kulkis To: users@lists.opensuse.org Subject: Re: [opensuse] OT: Need program to replace text Date: Sat, 10 Nov 2007 20:30:02 -0500 Message-ID: <47365B1A.9050003@hotpop.com> In-Reply-To: <30446637.11194741704528.JavaMail.root@mail> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2339196493222084915==" --===============2339196493222084915== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Chris Arnold wrote: > I have a bunch of html files that i need to do a couple of things to: > 1.remove the html and head tags and replace them with other code > 2.rename the file to .php > > Isn't there a program that will search all the files in a given > directory for html and head and then replace that with something > else? No, but you can write a shell-script using the find command and use the -exec option > Then rename the files? Do you mean the mv command? > I have seen the replace function > in gedit but it does not accept the php code that needs to be > inserted (i think the code is to long). Anyone no of a > program/way that will accomplish this? sed, the Stream EDitor Get the book "sed & awk" from O'Reilly books. Get away from the non-productive GUI and learn how to use the command line. That's where the power is. And don't tell me it's too hard... telephone company SECRETARIES were using it as far back as the 1970's. -- To unsubscribe, e-mail: opensuse+unsubscribe(a)opensuse.org For additional commands, e-mail: opensuse+help(a)opensuse.org --===============2339196493222084915==-- From blchupin@tpg.com.au Sun Nov 11 05:35:33 2007 From: Basil Chupin To: users@lists.opensuse.org Subject: Re: [opensuse] OT: Need program to replace text Date: Sun, 11 Nov 2007 16:36:28 +1100 Message-ID: <473694DC.8030903@tpg.com.au> In-Reply-To: <30446637.11194741704528.JavaMail.root@mail> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3180056731687813033==" --===============3180056731687813033== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Chris Arnold wrote: > I have a bunch of html files that i need to do a couple of things to: > 1.remove the html and head tags and replace them with other code > 2.rename the file to .php > > Isn't there a program that will search all the files in a given directory f= or html and head and then replace that with something else? Then rename the f= iles? I have seen the replace function in gedit but it does not accept the ph= p code that needs to be inserted (i think the code is to long). Anyone no of = a program/way that will accomplish this? > =20 Cannot help you with the first requirement but regarding renaming the=20 files use XnView to do this. XnView is basically a picture viewing=20 application but, surprisingly, it doesn't care what the files are when=20 you use its Batch Rename facility - it will happily rename the extension=20 of the files for you. Place all the html-extension files in the one directory then use the=20 Batch Rename facility in XnView to rename the extenions to .php. Cheers. --=20 Past experience, if not forgotten, is a guide for the future. --=20 To unsubscribe, e-mail: opensuse+unsubscribe(a)opensuse.org For additional commands, e-mail: opensuse+help(a)opensuse.org --===============3180056731687813033==-- From al4321@gmail.com Sun Nov 11 05:42:54 2007 From: Alexey Eremenko To: users@lists.opensuse.org Subject: Re: [opensuse] OT: Need program to replace text Date: Sun, 11 Nov 2007 07:43:56 +0200 Message-ID: <7fac565a0711102143o36d2bd76i14d52b6d23a5fc7c@mail.gmail.com> In-Reply-To: <473694DC.8030903@tpg.com.au> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1644598036899540545==" --===============1644598036899540545== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit KDE KDevelop can make a mass-find&replace. KDE Krusader can change your file extensions. -- -Alexey Eremenko "Technologov" -- To unsubscribe, e-mail: opensuse+unsubscribe(a)opensuse.org For additional commands, e-mail: opensuse+help(a)opensuse.org --===============1644598036899540545==-- From e_mccanless@bellsouth.net Sun Nov 11 06:07:09 2007 From: Ed McCanless To: users@lists.opensuse.org Subject: Re: [opensuse] OT: Need program to replace text Date: Sun, 11 Nov 2007 01:07:39 -0500 Message-ID: <47369C2B.2000407@bellsouth.net> In-Reply-To: <473694DC.8030903@tpg.com.au> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6401422858926020872==" --===============6401422858926020872== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Basil Chupin wrote: > Chris Arnold wrote: >> I have a bunch of html files that i need to do a couple of things to: >> 1.remove the html and head tags and replace them with other code >> 2.rename the file to .php >> >> Isn't there a program that will search all the files in a given >> directory for html and head and then replace that with something >> else? Then rename the files? I have seen the replace function in >> gedit but it does not accept the php code that needs to be inserted >> (i think the code is to long). Anyone no of a program/way that will >> accomplish this? >> > > Cannot help you with the first requirement but regarding renaming the > files use XnView to do this. XnView is basically a picture viewing > application but, surprisingly, it doesn't care what the files are when > you use its Batch Rename facility - it will happily rename the > extension of the files for you. > > Place all the html-extension files in the one directory then use the > Batch Rename facility in XnView to rename the extenions to .php. > > Cheers. > Doesn't Quanta plus have a function like this? -ED- -- To unsubscribe, e-mail: opensuse+unsubscribe(a)opensuse.org For additional commands, e-mail: opensuse+help(a)opensuse.org --===============6401422858926020872==-- From blchupin@tpg.com.au Sun Nov 11 07:00:18 2007 From: Basil Chupin To: users@lists.opensuse.org Subject: Re: [opensuse] OT: Need program to replace text Date: Sun, 11 Nov 2007 18:01:13 +1100 Message-ID: <4736A8B9.90709@tpg.com.au> In-Reply-To: <47369C2B.2000407@bellsouth.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8917648179046922376==" --===============8917648179046922376== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Ed McCanless wrote: > Basil Chupin wrote: > >> Chris Arnold wrote: >> >>> I have a bunch of html files that i need to do a couple of things to: >>> 1.remove the html and head tags and replace them with other code >>> 2.rename the file to .php >>> >>> Isn't there a program that will search all the files in a given >>> directory for html and head and then replace that with something >>> else? Then rename the files? I have seen the replace function in >>> gedit but it does not accept the php code that needs to be inserted >>> (i think the code is to long). Anyone no of a program/way that will >>> accomplish this? >>> >>> >> Cannot help you with the first requirement but regarding renaming the >> files use XnView to do this. XnView is basically a picture viewing >> application but, surprisingly, it doesn't care what the files are when >> you use its Batch Rename facility - it will happily rename the >> extension of the files for you. >> >> Place all the html-extension files in the one directory then use the >> Batch Rename facility in XnView to rename the extenions to .php. >> >> Cheers. >> >> > Doesn't Quanta plus have a function like this? > I absolutely have no idea. Leave it up to you to find out :-) . Cheers. PS. What is Quanta? -- Past experience, if not forgotten, is a guide for the future. -- To unsubscribe, e-mail: opensuse+unsubscribe(a)opensuse.org For additional commands, e-mail: opensuse+help(a)opensuse.org --===============8917648179046922376==-- From stephan.hegel@gmx.de Sun Nov 11 07:29:37 2007 From: Stephan Hegel To: users@lists.opensuse.org Subject: Re: [opensuse] OT: Need program to replace text Date: Sun, 11 Nov 2007 08:30:37 +0100 Message-ID: <4736AF9D.5000205@gmx.de> In-Reply-To: <4736A8B9.90709@tpg.com.au> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7662035665113437127==" --===============7662035665113437127== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Hi all, >>>> I have a bunch of html files that i need to do a couple of things to: >>>> 1.remove the html and head tags and replace them with other code >>>> 2.rename the file to .php I recommend rpl to replace strings in multiple files: http://fresh.t-systems-sfr.com/unix/src/privat2/rpl-1.4.0.tar.gz/ Changing the extension of a bunch of files is as easy as (/bin/sh): for i in *.html ; do mv $i `basename $i .html`.php done You need to be a fan of the command line, though ;). Rgds, Stephan. -- To unsubscribe, e-mail: opensuse+unsubscribe(a)opensuse.org For additional commands, e-mail: opensuse+help(a)opensuse.org --===============7662035665113437127==-- From michael@michael-skiba.de Sun Nov 11 10:31:15 2007 From: Michael Skiba To: users@lists.opensuse.org Subject: Re: [opensuse] OT: Need program to replace text Date: Sun, 11 Nov 2007 11:31:00 +0100 Message-ID: <200711111131.04802.michael@michael-skiba.de> In-Reply-To: <16337745.41194748074449.JavaMail.root@mail> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5847036996239895348==" --===============5847036996239895348== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Am Sonntag, 11. November 2007 03:27:54 schrieb Chris Arnold: > $ sed -i 's/red/blue/g' file > > to replace every entry called red with one that's called blue and write it > in the file(-i). You can of course use such things as ./* for the hole > directory.... > > man sed or man awk will provide you with further informations :) > > I have a long replacement text like this: > include(TEMPLATEPATH."/sidebar1.php");?>
> > and the text that needs to be replaced is: > Net Bible - Genesis HREF="style.css" TYPE="text/css" MEDIA=screen>

> > So the command i run looks like this; sed -i 's/Net > Bible - Genesis TYPE="text/css" MEDIA=screen>

/ require('../../wp-blog-header.php'); ?> include(TEMPLATEPATH."/sidebar1.php");?>

id="content">/g' ./* > > and i get this error: > sed: -e expression #1, char 99: unknown option to `s' I guess you've to escape various symbols first ;) Greetings Michael --===============5847036996239895348== Content-Type: application/pgp-signature Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="signature.asc" MIME-Version: 1.0 LS0tLS1CRUdJTiBQR1AgU0lHTkFUVVJFLS0tLS0KVmVyc2lvbjogR251UEcgdjEuNC41IChHTlUv TGludXgpCgppRDhEQlFCSE50bm9jSHdiVy96bE9ab1JBb2RQQUo5OWtLYUhKTnJVVXZaM0dIK2c2 T28wM1R0cURRQ2ZUUjg1CnRZcnloSXJ3anNaekV6V3JSRGNQNjZzPQo9b0dwKwotLS0tLUVORCBQ R1AgU0lHTkFUVVJFLS0tLS0K --===============5847036996239895348==-- From bcrafhfr@davjam.org Sun Nov 11 12:25:53 2007 From: David Bolt To: users@lists.opensuse.org Subject: Re: [opensuse] OT: Need program to replace text Date: Sun, 11 Nov 2007 12:26:09 +0000 Message-ID: <3sMfgjXhTvNHFwaw@dev.null.davjam.org> In-Reply-To: <16337745.41194748074449.JavaMail.root@mail> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0755741907731565768==" --===============0755741907731565768== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Sat, 10 Nov 2007, Chris Arnold wrote:- >So the command i run looks like this; sed -i 's/Net >Bible - Genesis TYPE=3D"text/css" MEDIA=3Dscreen>

/require('../../wp-blog-header.php'); ?>include(TEMPLATEPATH."/sidebar1.php");?>

id=3D"content">/g' ./* > >and i get this error: >sed: -e expression #1, char 99: unknown option to `s' Try replacing the delimiters with some other character, e.g. '#' sed -i 's#Net Bible - Genesis

#

#g' ./* Regards, David Bolt --=20 Team Acorn: http://www.distributed.net/ OGR-P2 @ ~100Mnodes RC5-72 @ ~15Mkeys | SUSE 10.1 32bit | openSUSE 10.2 32bit | openSUSE 10.3 32b= it SUSE 10.0 64bit | SUSE 10.1 64bit | openSUSE 10.2 64bit | RISC OS 3.11 | RISC OS 3.6 | TOS 4.02 | openSUSE 10.3 PPC --=20 To unsubscribe, e-mail: opensuse+unsubscribe(a)opensuse.org For additional commands, e-mail: opensuse+help(a)opensuse.org --===============0755741907731565768==-- From vankan@kabelfoon.nl Sun Nov 11 13:03:05 2007 From: Jos van Kan To: users@lists.opensuse.org Subject: Re: [opensuse] OT: Need program to replace text Date: Sun, 11 Nov 2007 14:04:03 +0100 Message-ID: <4736FDC3.6040807@kabelfoon.nl> In-Reply-To: <16337745.41194748074449.JavaMail.root@mail> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8603298085914322835==" --===============8603298085914322835== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Chris Arnold schreef: > $ sed -i 's/red/blue/g' file >=20 > to replace every entry called red with one that's called blue and write it = in=20 > the file(-i). You can of course use such things as ./* for the hole=20 > directory.... >=20 > man sed or man awk will provide you with further informations :) >=20 > I have a long replacement text like this: >
>=20 > and the text that needs to be replaced is: > Net Bible - Genesis

>=20 > So the command i run looks like this; sed -i 's/Net Bibl= e - Genesis

/

/g' ./* >=20 > and i get this error: > sed: -e expression #1, char 99: unknown option to `s' There are a couple of reasons why this does not work. First and foremost: sin= ce your replacement text contains '/', you should use a text separator different from '/' like s#foo#bar#g If I remember correctly < and > are also special (have to look that up) and y= ou should escape them: \< and \>. Finally, this would only work on a consecutive text without newlines and I th= ink that is not what you have in mind. Look up the c command in sed, because I think that is what you need. This lets you replace a couple of lines with a couple of other lines. --=20 Jos van Kan registered Linux user #152704 --=20 To unsubscribe, e-mail: opensuse+unsubscribe(a)opensuse.org For additional commands, e-mail: opensuse+help(a)opensuse.org --===============8603298085914322835==-- From e_mccanless@bellsouth.net Sun Nov 11 18:20:01 2007 From: Ed McCanless To: users@lists.opensuse.org Subject: Re: [opensuse] OT: Need program to replace text Date: Sun, 11 Nov 2007 13:20:31 -0500 Message-ID: <473747EF.7030906@bellsouth.net> In-Reply-To: <4736A8B9.90709@tpg.com.au> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6653208006159324644==" --===============6653208006159324644== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Basil Chupin wrote: > Ed McCanless wrote: >> Basil Chupin wrote: >> >>> Chris Arnold wrote: >>> >>>> I have a bunch of html files that i need to do a couple of things to: >>>> 1.remove the html and head tags and replace them with other code >>>> 2.rename the file to .php >>>> >>>> Isn't there a program that will search all the files in a given >>>> directory for html and head and then replace that with something >>>> else? Then rename the files? I have seen the replace function in >>>> gedit but it does not accept the php code that needs to be inserted >>>> (i think the code is to long). Anyone no of a program/way that will >>>> accomplish this? >>>> >>> Cannot help you with the first requirement but regarding renaming the >>> files use XnView to do this. XnView is basically a picture viewing >>> application but, surprisingly, it doesn't care what the files are when >>> you use its Batch Rename facility - it will happily rename the >>> extension of the files for you. >>> >>> Place all the html-extension files in the one directory then use the >>> Batch Rename facility in XnView to rename the extenions to .php. >>> >>> Cheers. >>> >>> >> Doesn't Quanta plus have a function like this? >> > I absolutely have no idea. Leave it up to you to find out :-) . > > Cheers. > > PS. What is Quanta? > OK, I refreshed my memory, as you subtly suggested. I could find no reference to running batch files in Quanta, but edit>find, edit> find next, and edit>replace provide a fairly quick way to do this type of work in Quanta plus. -ED- -- To unsubscribe, e-mail: opensuse+unsubscribe(a)opensuse.org For additional commands, e-mail: opensuse+help(a)opensuse.org --===============6653208006159324644==-- From carnold@electrichendrix.com Sun Nov 11 18:57:48 2007 From: Chris Arnold To: users@lists.opensuse.org Subject: Re: [opensuse] OT: Need program to replace text Date: Sun, 11 Nov 2007 13:58:43 -0500 Message-ID: <2640579.01194807523654.JavaMail.root@mail> In-Reply-To: <4736FDC3.6040807@kabelfoon.nl> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7538744697530298266==" --===============7538744697530298266== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable There are a couple of reasons why this does not work. First and foremost: sin= ce your replacement text contains '/', you should use a text separator different from '/' like s#foo#bar#g If I remember correctly < and > are also special (have to look that up) and y= ou should escape them: \< and \>. Finally, this would only work on a consecutive text without newlines and I th= ink that is not what you have in mind. Look up the c command in sed, because I think that is what you need. This lets you replace a couple of lines with a couple of other lines. OK, i have looked up the c command nd run this command: sed -ic 's#Net Bible - Genesis

#=

#g' ./* And this time, i do not get an error and i am left at the prompt. Then i chec= k 1 of the files and nothing has been replaced. So, is my syntax for the c co= mmand in sed right (sed -ic)? I tried sed -c and got an invalid --c option. I= wonder if some of the problem is that the Net Bible - Genesis </TITLE= > line is different for every file. In other words, for the book of Genesis, = for every chapter (every chapter is a new file), this line would read <TITLE>= Net Bible - Genesis - 50 for chapter 50. I think i need something lik= e a wildcard to use here in the sed command. I just tried it without the Net Bible - Genesis line in the sed command and it still does not= replace the text. I would be happy to send someone one of these htm files so= you could see what i am talking about. --=20 To unsubscribe, e-mail: opensuse+unsubscribe(a)opensuse.org For additional commands, e-mail: opensuse+help(a)opensuse.org --===============7538744697530298266==-- From vankan@kabelfoon.nl Sun Nov 11 23:59:23 2007 From: Jos van Kan To: users@lists.opensuse.org Subject: Re: [opensuse] OT: Need program to replace text Date: Sun, 11 Nov 2007 23:36:19 +0100 Message-ID: <473783E3.9020005@kabelfoon.nl> In-Reply-To: <2640579.01194807523654.JavaMail.root@mail> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7095962417359511145==" --===============7095962417359511145== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Chris Arnold schreef: > There are a couple of reasons why this does not work. First and foremost: s= ince > your replacement text contains '/', you should use a text separator differe= nt > from '/' like > s#foo#bar#g >=20 > If I remember correctly < and > are also special (have to look that up) and= you > should escape them: \< and \>. >=20 > Finally, this would only work on a consecutive text without newlines and I = think > that is not what you have in mind. >=20 > Look up the c command in sed, because I think that is what you need. This l= ets > you replace a couple of lines with a couple of other lines. >=20 > OK, i have looked up the c command nd run this command: > sed -ic 's#Net Bible - Genesis

#

#g' ./* >=20 > And this time, i do not get an error and i am left at the prompt. Then i ch= eck 1 of the files and nothing has been replaced. So, is my syntax for the c = command in sed right (sed -ic)? I tried sed -c and got an invalid --c option.= I wonder if some of the problem is that the Net Bible - Genesis </TIT= LE> line is different for every file. In other words, for the book of Genesis= , for every chapter (every chapter is a new file), this line would read <TITL= E>Net Bible - Genesis - 50 for chapter 50. I think i need something l= ike a wildcard to use here in the sed command. I just tried it without the Net Bible - Genesis line in the sed command and it still does n= ot replace the text. I would be happy to send someone one of these htm files = so you could see what i am talking about. There's a difference between command and option. You use the -ic option (I do= n't know what that does, but obviously not what you want) and the s command. I suggest you do a read up on sed. Google "sed tutorial" and if all else fails type #sed in konquerors location bar. Regards, --=20 Jos van Kan registered Linux user #152704 --=20 To unsubscribe, e-mail: opensuse+unsubscribe(a)opensuse.org For additional commands, e-mail: opensuse+help(a)opensuse.org --===============7095962417359511145==-- From rschulz@sonic.net Mon Nov 12 00:08:27 2007 From: Randall R Schulz To: users@lists.opensuse.org Subject: Re: [opensuse] OT: Need program to replace text Date: Sun, 11 Nov 2007 11:21:14 -0800 Message-ID: <200711111121.14612.rschulz@sonic.net> In-Reply-To: <2640579.01194807523654.JavaMail.root@mail> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2232664910418702107==" --===============2232664910418702107== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit On Sunday 11 November 2007 10:58, Chris Arnold wrote: > There are a couple of reasons why this does not work. First and > foremost: since your replacement text contains '/', you should use a > text separator different from '/' like > s#foo#bar#g > > If I remember correctly < and > are also special (have to look that > up) and you should escape them: \< and \>. No. They're special to the shell, but since you'll surely quote the entire sed argument holding the editing command, that's not an issue. In fact, putting backslash before angle brackets gives them special meaning, namely word boundaries, left and right, for \< and \>, resp. > ... Randall Schulz -- To unsubscribe, e-mail: opensuse+unsubscribe(a)opensuse.org For additional commands, e-mail: opensuse+help(a)opensuse.org --===============2232664910418702107==-- From carnold@electrichendrix.com Mon Nov 12 00:40:24 2007 From: Chris Arnold To: users@lists.opensuse.org Subject: Re: [opensuse] OT: Need program to replace text Date: Sun, 11 Nov 2007 14:41:54 -0500 Message-ID: <16421645.31194810114297.JavaMail.root@mail> In-Reply-To: <4736AF9D.5000205@gmx.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0203463036097120512==" --===============0203463036097120512== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable I recommend rpl to replace strings in multiple files: http://fresh.t-systems-sfr.com/unix/src/privat2/rpl-1.4.0.tar.gz/ I try this page and get a timeout in firefox2. Changing the extension of a bunch of files is as easy as (/bin/sh): for i in *.html ; do mv $i `basename $i .html`.php done You need to be a fan of the command line, though ;). No problems with the command line but after making a file called "rename" wit= h the above code in it (rename file is located in the directory where i need = to rename the files), i run ./rename and instead of the files being renamed t= hey are just copied. So, 1file.htm has become 1file.htmc and every time i run= rename it just adds a "c" to the end of the file name. So, 1file.htmc, if re= name is run again, becomes 1file.htmcc --=20 To unsubscribe, e-mail: opensuse+unsubscribe(a)opensuse.org For additional commands, e-mail: opensuse+help(a)opensuse.org --===============0203463036097120512==-- From sh@suse.de Mon Nov 12 10:37:59 2007 From: Stefan Hundhammer To: users@lists.opensuse.org Subject: Re: [opensuse] OT: Need program to replace text Date: Mon, 12 Nov 2007 11:39:10 +0100 Message-ID: <200711121139.10365.sh@suse.de> In-Reply-To: <30446637.11194741704528.JavaMail.root@mail> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1561189678692095696==" --===============1561189678692095696== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit On Sunday 11 November 2007 01:41, Chris Arnold wrote: > I have a bunch of html files that i need to do a couple of things to: > 1.remove the html and head tags and replace them with other code perl -p -i -e 's/oldtext/newtext/' *.html > 2.rename the file to .php mmv "*.html" "#1.php" (you might have to install package mmv first) CU -- Stefan Hundhammer Penguin by conviction. YaST2 Development SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg) Nürnberg, Germany -- To unsubscribe, e-mail: opensuse+unsubscribe(a)opensuse.org For additional commands, e-mail: opensuse+help(a)opensuse.org --===============1561189678692095696==-- From carnold@electrichendrix.com Mon Nov 12 21:23:15 2007 From: Chris Arnold To: users@lists.opensuse.org Subject: Re: [opensuse] OT: Need program to replace text Date: Mon, 12 Nov 2007 16:24:18 -0500 Message-ID: <4738C482.2050105@electrichendrix.com> In-Reply-To: <200711121139.10365.sh@suse.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4960755578870234915==" --===============4960755578870234915== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Stefan Hundhammer wrote: > perl -p -i -e 's/oldtext/newtext/' *.html > /oldtext will be lines of html and /newtext will be lines of php. Will perl still be able to do it and if so, do i need to escape some of the code in oldtext and newtext? Example: the < and > and does any of that need to be escaped? -- To unsubscribe, e-mail: opensuse+unsubscribe(a)opensuse.org For additional commands, e-mail: opensuse+help(a)opensuse.org --===============4960755578870234915==-- From chika@cs.its.ac.id Tue Nov 13 07:16:16 2007 From: chika To: users@lists.opensuse.org Subject: [opensuse] [virtualbox] installation SOLVED (recommended to read) Date: Tue, 13 Nov 2007 14:18:38 +0700 Message-ID: <1613.10.126.12.35.1194938318.squirrel@webmail.cs.its.ac.id> In-Reply-To: <7fac565a0711102143o36d2bd76i14d52b6d23a5fc7c@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1139779096602582662==" --===============1139779096602582662== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit thanks to Alexey Eremenko "Technologov" for opensuse for lizard esp on virtual box installation, i always fail in networking when i install from rpm / official package. then when try run installer for all distribution n follow the instruction on the user manual, the same, not work. to all users who wanna install the virtual box get the installater for all distro n follow the alexey book esp on installation section. br, tambun -- To unsubscribe, e-mail: opensuse+unsubscribe(a)opensuse.org For additional commands, e-mail: opensuse+help(a)opensuse.org --===============1139779096602582662==-- From grahamsmith@gandalfsemporium.homelinux.com Tue Nov 13 09:12:38 2007 From: G T Smith To: users@lists.opensuse.org Subject: Re: [opensuse] OT: Need program to replace text Date: Tue, 13 Nov 2007 09:13:40 +0000 Message-ID: <47396AC4.1010502@gandalfsemporium.homelinux.com> In-Reply-To: <4738C482.2050105@electrichendrix.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5663458069333131527==" --===============5663458069333131527== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Chris Arnold wrote: > Stefan Hundhammer wrote: >> perl -p -i -e 's/oldtext/newtext/' *.html >> > /oldtext will be lines of html and /newtext will be lines of php. Will > perl still be able to do it and if so, do i need to escape some of the > code in oldtext and newtext? Example: > the < and > > and > does any of that need to be escaped? Probably a little over the top but ... man perlrequick nand man perlretut will help... - -- ============================================================================== I have always wished that my computer would be as easy to use as my telephone. My wish has come true. I no longer know how to use my telephone. Bjarne Stroustrup ============================================================================== -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iD8DBQFHOWrEasN0sSnLmgIRAjEsAJ4oOAoKEEsGuEBX/vqS+Xi9b3ks6gCfZ37O F2EU35JlAg+7nUCdYIZXoNQ= =ESp3 -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe(a)opensuse.org For additional commands, e-mail: opensuse+help(a)opensuse.org --===============5663458069333131527==-- From sh@suse.de Tue Nov 13 11:44:51 2007 From: Stefan Hundhammer To: users@lists.opensuse.org Subject: Re: [opensuse] OT: Need program to replace text Date: Tue, 13 Nov 2007 12:46:04 +0100 Message-ID: <200711131246.05232.sh@suse.de> In-Reply-To: <4738C482.2050105@electrichendrix.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1831771647470732959==" --===============1831771647470732959== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Monday 12 November 2007 22:24, Chris Arnold wrote: > Stefan Hundhammer wrote: > > perl -p -i -e 's/oldtext/newtext/' *.html > > /oldtext will be lines of html and /newtext will be lines of php. Will > perl still be able to do it and if so, do i need to escape some of the > code in oldtext and newtext? Example: > the < and > > and > does any of that need to be escaped? I did some experimenting, and admittedly there are some caveats with that=20 stuff. But here is a skeleton for you: perl -p -i -0777 \ -e 's/^.*/PHP-Header\n/si;' \ -e 's:.*$:\n:si;' \ -e 's:moreoldstuff:newoldstuff:g;' \ *.html Note: This is one single line of shell command. I just reformatted it for=20 better legibility. Let's take this apart. perl -p : This reads the files specified on the command line as input files = line by line and prints each single line. If you don't do anything else, this= =20 is a glorified "copy" command. But with regular search-and-replace, this=20 becomes more like a "sed" call. Note there is also "perl -n" which does not=20 print; you'd have to append 'p' ("print") to each regexp replace to write=20 something to the output file, or use the regular perl "print" command. -i : This does all changes in-place, i.e. you don't need to supply an input = and an output file. Otherwise you'd have to write your own loop in the shell = and do something like perl -p -e'' outfile =20 perl -i does that loop for you, reads from each infile from the command line,= =20 writes to a new file and renames the new file afterwards to the name of the=20 infile. You can also specify a backup file extension: "perl -i.bak" will back= =20 up all old infiles to "infile.bak". -e : This specifies one perl expression. You can use several -e args, but=20 then you need to delimit all (except the last one) with a semicolon. A bit=20 unlike "sed", unfortunately. By default, perl reads one single line from the infile, processes it with all= =20 your -e expressions and (with -p) writes it to the outfile. This is what most= =20 people need in most cases. You can use that as a "sed" substitute with=20 in-place editing - this is what I wrote in my first post to this thread: perl -p -i -e 's/oldstuff/newstuff/g' The '/g' at the end tells perl to do that globally, i.e., more than once.=20 Otherwise it would just replace one single time. Just like "sed". In your special case, though, you want to search and replace over multiple=20 lines. That's a bit tricker. For one thing, you need to tell perl to read=20 more than just one line at a time. For example, the entire file at once. This= =20 is what -0777 does: It changes the input record delimiter from \n (newline) to character=20 0777 (octal) which doesn't exist, thus the entire file is read at once.=20 (See "man perlrun"). Then, you also have to make perl match more than just one single line in a=20 regular expression: s/oldstuff/morestuff/s=20 Note that this is necessary in addition to having the whole file in one singl= e=20 string. I also added /i to match case-insensitive which makes sense for HTML tags. Quoting regular expressions is another tricky part. You have to watch=20 carefully which characters in "oldstuff" have a special meaning in perl's=20 (very powerful!) regular expressions. But typically that's not a problem=20 because that part is hand-written, not variable stuff coming from a file. \s is useful: It's a shorthand for "any kind of whitespace character" - blank= ,=20 tab, newline. "\s+" means "at least one whitespace character, but maybe more = (any number)". In the replace text there are a lot less characters with special meaning. $1,= =20 $2, ... $9 come to mind; they are placeholders for an expression in=20 parentheses in "oldstuff". If your search regexp contains slashes, it makes sense to use some other=20 delimiter character; this is what I did in the other -e expressions: s:oldstuff/with/slashes:newstuff: You could also escape every single slash with a backslash, but that's tedious= ,=20 error-prone and it looks ugly: s:oldstuff\/with\/slashes/newstuff/ Did I forget something? Probably. But hey, I don't want to deprive you of all= =20 intellectual challenges. ;-) I hope I gave you some good starting points,=20 though. More info: man perlre (Perl regular expressions) man perlrun (Perl command line switches) man perlop (Perl quoting) CU --=20 Stefan Hundhammer Penguin by conviction. YaST2 Development SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG N=C3=BCrnberg) N=C3=BCrnberg, Germany --=20 To unsubscribe, e-mail: opensuse+unsubscribe(a)opensuse.org For additional commands, e-mail: opensuse+help(a)opensuse.org --===============1831771647470732959==-- From al4321@gmail.com Tue Nov 13 16:48:32 2007 From: Alexey Eremenko To: users@lists.opensuse.org Subject: [opensuse] Re: [virtualbox] installation SOLVED (recommended to read) Date: Tue, 13 Nov 2007 18:46:49 +0200 Message-ID: <7fac565a0711130846jc633d96xb440a3afb95cf23a@mail.gmail.com> In-Reply-To: <1613.10.126.12.35.1194938318.squirrel@webmail.cs.its.ac.id> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6681947055995640933==" --===============6681947055995640933== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit On Nov 13, 2007 9:18 AM, chika wrote: > thanks to Alexey Eremenko "Technologov" for opensuse for lizard > esp on virtual box installation, > > i always fail in networking when i install from rpm / official package. > then when try run installer for all distribution n follow the instruction > on the user manual, the same, not work. > > to all users who wanna install the virtual box get the installater for all > distro n follow the alexey book esp on installation section. > I'm glad to hear that it helped to somebody ! Lately there is a boom of VirtualBox popularity :) BTW: It's not openSUSE for lizard, but it's "Lessons for Lizards" (LfL). It can be installed into 10.3 as offline help - Use Yast Software Manager, search and install "lessons4lizards" rpm. Then Start->Help->Lessons for Lizards. Both VirtualBox and my guide are integrated into openSUSE 10.3 OS. Best wishes, -- -Alexey Eremenko "Technologov" -- To unsubscribe, e-mail: opensuse+unsubscribe(a)opensuse.org For additional commands, e-mail: opensuse+help(a)opensuse.org --===============6681947055995640933==-- From chika@cs.its.ac.id Fri Nov 16 08:19:39 2007 From: chika To: users@lists.opensuse.org Subject: Re: [opensuse] Re: [virtualbox] installation SOLVED (recommended to read) Date: Fri, 16 Nov 2007 15:22:07 +0700 Message-ID: <1162.10.126.12.4.1195201327.squirrel@webmail.cs.its.ac.id> In-Reply-To: <7fac565a0711130846jc633d96xb440a3afb95cf23a@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6071503055857937303==" --===============6071503055857937303== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit sorry... for the name.... btw i have problem with seamless windows xp. i have uml-utilities installed, i've followed your instruction there. br0, tap0, eth0 set to none (aka no ip address). what should i do if on the guest i have xp then i wanna remote seamlessly from my susebox? n access samba server from the xp? can u give me the link reference? booming of virtualbox ... off course ... coz it is the better solution. br, tambun > On Nov 13, 2007 9:18 AM, chika wrote: >> thanks to Alexey Eremenko "Technologov" for opensuse for lizard >> esp on virtual box installation, >> >> i always fail in networking when i install from rpm / official package. >> then when try run installer for all distribution n follow the >> instruction >> on the user manual, the same, not work. >> >> to all users who wanna install the virtual box get the installater for >> all >> distro n follow the alexey book esp on installation section. >> > > I'm glad to hear that it helped to somebody ! Lately there is a boom > of VirtualBox popularity :) > > BTW: It's not openSUSE for lizard, but it's "Lessons for Lizards" (LfL). > > It can be installed into 10.3 as offline help - Use Yast Software > Manager, search and install "lessons4lizards" rpm. Then > Start->Help->Lessons for Lizards. > > Both VirtualBox and my guide are integrated into openSUSE 10.3 OS. > > Best wishes, > -- > -Alexey Eremenko "Technologov" > -- > To unsubscribe, e-mail: opensuse+unsubscribe(a)opensuse.org > For additional commands, e-mail: opensuse+help(a)opensuse.org > > -- To unsubscribe, e-mail: opensuse+unsubscribe(a)opensuse.org For additional commands, e-mail: opensuse+help(a)opensuse.org --===============6071503055857937303==--