Re: OT: Help with a search and replace script in Perl for a big file with no line breaks

2018-01-27 Thread David Christensen
> On Jan 27, 2018, at 12:58 AM, tomas wrote: > > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On Fri, Jan 26, 2018 at 03:31:37PM -0800, David Christensen wrote: > > [...] > >> I've "cleaned up" more files than I care to remember. (Perl s/// is the >> road to madness for anything

Re: OT: Help with a search and replace script in Perl for a big file with no line breaks

2018-01-27 Thread tomas
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Fri, Jan 26, 2018 at 03:31:37PM -0800, David Christensen wrote: [...] > I've "cleaned up" more files than I care to remember. (Perl s/// is the > road to madness for anything but the most trivial cases.) I wanted to give > the OP an idea of

Re: OT: Help with a search and replace script in Perl for a big file with no line breaks

2018-01-26 Thread deloptes
David Christensen wrote: > Yes -- I'm such an insensitive ass.  ;-) > nice to meet you :) > > I've "cleaned up" more files than I care to remember.  Lexing, parsing, > and EBFN are the standard computer science tools for tasks such as this. > (Perl s/// is the road to madness for anything

Re: OT: Help with a search and replace script in Perl for a big file with no line breaks

2018-01-26 Thread David Christensen
ail.com wrote: > > The file is ugly, with lots of extraneous characters--I want to run a series > of > regular expression search and replace commands over the file to clean it up. I've "cleaned up" more files than I care to remember. Lexing, parsing, and EBFN are the standard computer

Re: OT: Help with a search and replace script in Perl for a big file with no line breaks

2018-01-24 Thread deloptes
David Christensen wrote: > I used to subscribe to Perl Beginners, but the administrator got draconian > about discussing other languages, I dropped, and now I appear to be > banned: > > https://lists.perl.org/list/beginners.html > > >> I've never used Perl, but I'm hoping Perl can do the job

Re: OT: Help with a search and replace script in Perl for a big file with no line breaks

2018-01-24 Thread David Christensen
dump from a database--I have no control over the database or the format ofe > dump. > > The file is ugly, with lots of extraneous characters--I want to run a series > of > regular expression search and replace commands over the file to clean it up. > > Some of the things th

Re: OT: Help with a search and replace script in Perl for a big file with no line breaks

2018-01-24 Thread rhkramer
On Wednesday, January 24, 2018 03:21:19 PM to...@tuxteam.de wrote: > On Wed, Jan 24, 2018 at 02:14:42PM -0500, rhkra...@gmail.com wrote: > > This is OT, but I thought I'd start with this list as it is the list that > > I deal with more than any other. If no one here can help, suggestions > > for

Re: OT: Help with a search and replace script in Perl for a big file with no line breaks

2018-01-24 Thread tomas
e format ofe > dump. Perl won't have a problem with a 5.4MB long line. [...] >* The file can, and often will have UTF-8 characters in it (iiuc--the file > contains URLs, some of which, I'm sure, can include UTF-8 characters, or > maybe > some other encoding??). The search an

OT: Help with a search and replace script in Perl for a big file with no line breaks

2018-01-24 Thread rhkramer
large files (one example is 5.4 MB). It is essentially a data dump from a database--I have no control over the database or the format ofe dump. The file is ugly, with lots of extraneous characters--I want to run a series of regular expression search and replace commands over the file to clean

Re: search and replace code in php or html files

2006-05-06 Thread J.A. de Vries
On 2006-05-05 @ 18:48:36 (week 18) H.S. wrote: Casey T. Deccio wrote: find . -name *.html | xargs sed -i.bak -e 's/string_to_replace/replacement/g' Does something like this work? If your match pattern spans more than one line than you'll need a more complex script. Might I

search and replace code in php or html files

2006-05-05 Thread H.S.
a particular link in all the pages. I assume the webpages were made using a template. If I were to search and replace a particular string with a the new desired one, I would be done. Could somebody suggest the best way to use grep and sed to make these changes? The main problems are matching HTML code

Re: search and replace code in php or html files

2006-05-05 Thread Linas Žvirblis
H.S. wrote: The problem is to change a particular link in all the pages. I assume the webpages were made using a template. If I were to search and replace a particular string with a the new desired one, I would be done. Check out rpl package. As an aside, given the webpage, is there anyway

Re: search and replace code in php or html files

2006-05-05 Thread H.S.
Linas Žvirblis wrote: Check out rpl package. I will take a look, thanks. See if it contains a generator meta tag. Other than that, sites made with Frontpage will contain all sorts of errors, MS specific code etc. This is not a scientific definition, but if it looks like crap, it most

RE: search and replace code in php or html files

2006-05-05 Thread Gwenissia
It was generated by dreamweaver then - Dreamweaver prefixes the javascript functions it creates for rollover images with mm Regards, Pat -Original Message- From: news [mailto:[EMAIL PROTECTED] On Behalf Of H.S. Sent: 05 May 2006 18:45 To: debian-user@lists.debian.org Subject: Re: search

Re: search and replace code in php or html files

2006-05-05 Thread Casey T. Deccio
On Fri, 2006-05-05 at 13:16 -0400, H.S. wrote: The problem is to change a particular link in all the pages. I assume the webpages were made using a template. If I were to search and replace a particular string with a the new desired one, I would be done. Could somebody suggest the best way

Re: search and replace code in php or html files

2006-05-05 Thread Joris Huizer
Casey T. Deccio wrote: On Fri, 2006-05-05 at 13:16 -0400, H.S. wrote: The problem is to change a particular link in all the pages. I assume the webpages were made using a template. If I were to search and replace a particular string with a the new desired one, I would be done. Could somebody

Re: search and replace code in php or html files

2006-05-05 Thread H.S.
Casey T. Deccio wrote: find . -name *.html | xargs sed -i.bak -e 's/string_to_replace/replacement/g' Does something like this work? If your match pattern spans more than one line than you'll need a more complex script. Casey For all cases so far, I haven't had any need to

global search and replace

2004-06-16 Thread Zenaan Harkness
What do people use for multi-file/ multi-directory search and replace? I use something like this: find . -name \*java|xargs perl -p -i.bak -e 's/searchRE/replaceRE/g;' However, I would also like to see which files actually got changed. With the in-place option (-i[backup-extension]), every

Re: global search and replace

2004-06-16 Thread Jacob S.
On Thu, 17 Jun 2004 08:46:38 +1000 Zenaan Harkness [EMAIL PROTECTED] wrote: What do people use for multi-file/ multi-directory search and replace? I use something like this: find . -name \*java|xargs perl -p -i.bak -e 's/searchRE/replaceRE/g;' However, I would also like to see which

Re: more OT: search-and-replace commands (was Re: OT: Why is C so popular?)

2003-08-28 Thread Yves Goergen
Von: Harshwardhan Nagaonkar [EMAIL PROTECTED] Hahaha. It always amuses me whenever we have a thread about a particular topic, which refrences a particular search-and-replace command. Various other people reply and give examples with which the said search-and-replace command will not work

Re: more OT: search-and-replace commands (was Re: OT: Why is C sopopular?)

2003-08-28 Thread Alex Malinovich
On Wed, 2003-08-27 at 18:15, Yves Goergen wrote: right. i was wondering, not long ago, if there's a possibility to merge both parameters of the 'rename' shell script into one and port all this to, say, windows. there are many situations where such a tool would make my life a bit easier... As

Re: more OT: search-and-replace commands (was Re: OT: Why is C sopopular?)

2003-08-28 Thread Ron Johnson
On Thu, 2003-08-28 at 02:08, Alex Malinovich wrote: On Wed, 2003-08-27 at 18:15, Yves Goergen wrote: [snip] As much as I hate to admit that MS can do some things right, their 'ren' command (rename, instead of doing a mv from name to name like we do) is actually quite intelligent. Not quite to

Re: more OT: search-and-replace commands (was Re: OT: Why is C so popular?)

2003-08-28 Thread Al Davis
On Thursday 28 August 2003 03:08 am, Alex Malinovich wrote: As much as I hate to admit that MS can do some things right, their 'ren' command (rename, instead of doing a mv from name to name like we do) is actually quite intelligent. Wasn't that part of QDOS? -- To UNSUBSCRIBE, email to

Re: more OT: search-and-replace commands (was Re: OT: Why is C so popular?)

2003-08-28 Thread Tom Badran
On Thursday 28 Aug 2003 13:24, Al Davis wrote: On Thursday 28 August 2003 03:08 am, Alex Malinovich wrote: As much as I hate to admit that MS can do some things right, their 'ren' command (rename, instead of doing a mv from name to name like we do) is actually quite intelligent. Wasn't

more OT: search-and-replace commands (was Re: OT: Why is C so popular?)

2003-08-27 Thread Harshwardhan Nagaonkar
a particular search-and-replace command. Various other people reply and give examples with which the said search-and-replace command will not work; and then give their own versions of the command. All that said, isn't there like a One True Search-and-replace Command which will handle all

Re: Command line search and replace

2001-01-10 Thread Joey Hess
Jonathan D. Proulx wrote: also note that you must quote the wildcard '*.txt' to prevent shell expantion, but I feel the example stands bugs and all. Using xargs or for i in `find . -name '*.txt'` can result in stack overflows if there are alot of file (I don't know howmany, but it happened to

Re: Command line search and replace

2001-01-10 Thread kmself
on Tue, Jan 09, 2001 at 08:30:59PM -0500, Jonathan D. Proulx ([EMAIL PROTECTED]) wrote: On Tue, Jan 09, 2001 at 11:29:31AM -0800, kmself@ix.netcom.com wrote: :on Tue, Jan 09, 2001 at 08:20:18AM -0500, Jonathan D. Proulx ([EMAIL PROTECTED]) wrote: : find . -name *.txt -exec cp {} {}.tmp \;

Re: Command line search and replace

2001-01-09 Thread kmself
on Mon, Jan 08, 2001 at 05:53:51PM -0500, Jonathan D. Proulx ([EMAIL PROTECTED]) wrote: On Tue, Jan 09, 2001 at 12:54:34AM +0800, csj wrote: :for i in *.txt ; do mv $i $i.tmp ; sed s/foo/boo/g $i.tmp $i ; done : :Can anybody comment on this little script? This appears to work, but :may

Re: Command line search and replace

2001-01-09 Thread Jonathan D. Proulx
On Mon, Jan 08, 2001 at 11:52:26PM -0800, kmself@ix.netcom.com wrote: : My vote for most elegant: : : find . -name *.txt -exec sed s/foo/boo/g {} \; : {} refers to file found ^ ^must have \; to terminate : -exec : :This solution doesn't

Re: Command line search and replace

2001-01-09 Thread list
csj schrieb: On Mon, Jan 08, 2001 at 12:56:45AM +0800, I wrote: Is there a tool to do a search-and-replace from the command line? Something along the lines of: replace string one string foo files-to-process sed is it! Thanks to John [EMAIL PROTECTED], Michal [EMAIL PROTECTED], und

[Sorry] Re: Command line search and replace

2001-01-09 Thread Erdmut Pfeifer
:34PM +0100, [EMAIL PROTECTED] wrote: csj schrieb: On Mon, Jan 08, 2001 at 12:56:45AM +0800, I wrote: Is there a tool to do a search-and-replace from the command line? Something along the lines of: replace string one string foo files-to-process sed is it! Thanks to John [EMAIL

Re: Command line search and replace

2001-01-09 Thread kmself
on Tue, Jan 09, 2001 at 08:20:18AM -0500, Jonathan D. Proulx ([EMAIL PROTECTED]) wrote: On Mon, Jan 08, 2001 at 11:52:26PM -0800, kmself@ix.netcom.com wrote: : My vote for most elegant: : : find . -name *.txt -exec sed s/foo/boo/g {} \; : {} refers to file found ^ ^must

Re: Command line search and replace

2001-01-09 Thread Jonathan D. Proulx
On Tue, Jan 09, 2001 at 11:29:31AM -0800, kmself@ix.netcom.com wrote: :on Tue, Jan 09, 2001 at 08:20:18AM -0500, Jonathan D. Proulx ([EMAIL PROTECTED]) wrote: : find . -name *.txt -exec cp {} {}.tmp \; -exec sed s/foo/boo/g {} \; : : or writing a small shell/perl/sed/awk/whatever script that

Re: Command line search and replace

2001-01-08 Thread N. Raghavendra
On Sun, Jan 07, 2001 at 06:12:54PM +0100, Michal F. Hanula wrote: On Mon, Jan 08, 2001 at 12:56:45AM +0800, csj wrote: Is there a tool to do a search-and-replace from the command line? Something along the lines of: replace string one string foo files-to-process I find it a bit

Re: Command line search and replace

2001-01-08 Thread kmself
on Mon, Jan 08, 2001 at 01:42:08AM +0800, eechi von akusyumi ([EMAIL PROTECTED]) wrote: suggestion: cat file | sed s/search/replace/gi file2;cp file2 file1; Note that this solution creates an additional process for each file handled. The more elegant solution is: $ sed -e '/search/s

Re: Command line search and replace

2001-01-08 Thread Joachim Ostwald
csj wrote: Is there a tool to do a search-and-replace from the command line? Something along the lines of: replace string one string foo files-to-process I find it a bit of a hassle to keep 100+ files open just to change an .html to an .htm. Note however that I intend to use the tool

Re: Command line search and replace

2001-01-08 Thread csj
On Mon, Jan 08, 2001 at 12:56:45AM +0800, I wrote: Is there a tool to do a search-and-replace from the command line? Something along the lines of: replace string one string foo files-to-process sed is it! Thanks to John [EMAIL PROTECTED], Michal [EMAIL PROTECTED], und eechi von akusyumi

Re: Command line search and replace

2001-01-08 Thread Christoph Simon
On Tue, 9 Jan 2001 00:54:34 +0800 csj [EMAIL PROTECTED] wrote: On Mon, Jan 08, 2001 at 12:56:45AM +0800, I wrote: Is there a tool to do a search-and-replace from the command line? Something along the lines of: replace string one string foo files-to-process sed is it! Thanks to John

Re: Command line search and replace

2001-01-08 Thread Robert L. Yelvington
then do this: for i in `find . -name *.txt` ; do blah ; done and make sure you know what you're doing. cheers, robt csj wrote: On Mon, Jan 08, 2001 at 12:56:45AM +0800, I wrote: Is there a tool to do a search-and-replace from the command line? Something along the lines of: replace

Re: Command line search and replace

2001-01-08 Thread Jonathan D. Proulx
On Tue, Jan 09, 2001 at 12:54:34AM +0800, csj wrote: :for i in *.txt ; do mv $i $i.tmp ; sed s/foo/boo/g $i.tmp $i ; done : :Can anybody comment on this little script? This appears to work, but :may be inefficient. And it's one step removed from what I want, :recursive processing. That is, to

Command line search and replace

2001-01-07 Thread csj
Is there a tool to do a search-and-replace from the command line? Something along the lines of: replace string one string foo files-to-process I find it a bit of a hassle to keep 100+ files open just to change an .html to an .htm. Note however that I intend to use the tool on other text files

Re: Command line search and replace

2001-01-07 Thread Michal F. Hanula
On Mon, Jan 08, 2001 at 12:56:45AM +0800, csj wrote: Is there a tool to do a search-and-replace from the command line? Something along the lines of: replace string one string foo files-to-process I find it a bit of a hassle to keep 100+ files open just to change an .html to an .htm

Re: Command line search and replace

2001-01-07 Thread John Hasler
csj writes: Is there a tool to do a search-and-replace from the command line? Something along the lines of: replace string one string foo files-to-process Look at awk and sed. -- John Hasler [EMAIL PROTECTED] Dancing Horse Hill Elmwood, Wisconsin

Re: Command line search and replace

2001-01-07 Thread eechi von akusyumi
suggestion: cat file | sed s/search/replace/gi file2;cp file2 file1; - Original Message - From: John Hasler [EMAIL PROTECTED] To: debian-user@lists.debian.org Sent: Monday, January 08, 2001 1:29 AM Subject: Re: Command line search and replace csj writes: Is there a tool to do

Howto search and replace...

2000-05-10 Thread Jaume Teixi
Howto search and replace for a pattern over all system files ? It's faster with vi, ed ?

Re: Howto search and replace...

2000-05-10 Thread Oswald Buddenhagen
Howto search and replace for a pattern over all system files ? try a perl-expression. find / '!' -type d -exec perl -e s/foo/bar/baz '{}' ';' this is definitely not ready-to-run, but it's a good point to start from. look at the perl man page. -- Hi! I'm a .signature virus! Copy me

Re: Howto search and replace...

2000-05-10 Thread Graeme Mathieson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, Jaume Teixi [EMAIL PROTECTED] writes: Howto search and replace for a pattern over all system files ? It's faster with vi, ed ? sed. And a bit of shell script. For instance (off the top of my head, so no guarantees): for i in $file_list

Re: Howto search and replace...

2000-05-10 Thread w trillich
perl is designed for this kind of thing. use it carefully, though--AFTER you back everything up! #!/usr/bin/perl use File::Find; see 'man File::Find' (or perldoc 'File::Find') for the full poop. -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- Their is five errers in this sentance.

Re: Search and Replace

1999-01-11 Thread Frank Barknecht
John Greer hat gesagt: // John Greer wrote: I know that this is not Debian specific but I thought I would give it a shot anyway. I need to search a series of files for a text string (grep I know) and then I need to replace that string with another. Is there a command or string of

Re: Search and Replace

1999-01-10 Thread shaul
sed was made for that. there are lots of other tools that are more programming-oriented (awk, perl, python...); sed is simple and a bit cryptic but good to get to know. Are there www sites from where I can download introductory level texts for these tools ?

Re: Search and Replace

1999-01-10 Thread Carey Evans
[EMAIL PROTECTED] (shaul) writes: Are there www sites from where I can download introductory level texts for these tools ? awk: info gawk (Install gawk package first) sed: man sed, under SEE ALSO Perl: http://language.perl.com/ Python: http://www.python.org/ or

Re: Search and Replace

1999-01-08 Thread John Greer
I know that this is not Debian specific but I thought I would give it a shot anyway. I need to search a series of files for a text string (grep I know) and then I need to replace that string with another. Is there a command or string of commands that I can do this in? If this is possible it

Re: Search and Replace

1999-01-08 Thread Jeff Noxon
On Fri, Jan 08, 1999 at 08:49:10AM -0700, John Greer wrote: I know that this is not Debian specific but I thought I would give it a shot anyway. I need to search a series of files for a text string (grep I know) and then I need to replace that string with another. Is there a command or

Re: Search and Replace

1999-01-08 Thread David Coe
sed was made for that. there are lots of other tools that are more programming-oriented (awk, perl, python...); sed is simple and a bit cryptic but good to get to know. John Greer wrote: I know that this is not Debian specific but I thought I would give it a shot anyway. I need to search

Re: Search and Replace

1999-01-08 Thread Alexander Kushnirenko
Hi, Yes there are quite a few ways to do that, another example: GLOBAL REPLACE in the files: awk '{gsub(call, mall, $0); print FILENAME}' *.kumac change call to mall in all *.kumac files Word of CAUTION: If you process really big files you may run into trouble, that only part of your file

Re: Multible search and replace?

1997-01-10 Thread Ralph Winslow
When Joey Hess wrote, I replied: This is especially nifty because from may be a perl regular expression (including parentheses pairs enclosing substrings of itself) and to may include $1, $2... refernces to such pairs- very handy. Was just wondering if there is a package out that does

Re: Multible search and replace?

1997-01-10 Thread Joey Hess
This is especially nifty because from may be a perl regular expression (including parentheses pairs enclosing substrings of itself) and to may include $1, $2... refernces to such pairs- very handy. Well, not with the example I gave you can't, but if you use something like this, you can use all

Re: Multible search and replace?

1997-01-09 Thread Rick Macdonald
Chad Zimmerman wrote: Was just wondering if there is a package out that does multiple file search and replaces? I have to go through my main html directory and make a lot of repetive changes. Was wondering if there was a package or a perl script laying arround to do this. Would same me

Re: Multible search and replace?

1997-01-09 Thread Mathieu GUILLAUME
Chad Zimmerman ([EMAIL PROTECTED]) wrote: : Was just wondering if there is a package out that does multiple file : search and replaces? I have to go through my main html directory and make : a lot of repetive changes. Was wondering if there was a package or a perl : script laying arround to do

Re: Multible search and replace?

1997-01-09 Thread Hakan Ardo
-BEGIN PGP SIGNED MESSAGE- On Wed, 8 Jan 1997, Chad Zimmerman wrote: Was just wondering if there is a package out that does multiple file search and replaces? I have to go through my main html directory and make a lot of repetive changes. Was wondering if there was a package or a

Re: Multible search and replace?

1997-01-09 Thread Richard G. Roberto
On Wed, 8 Jan 1997, Rick Macdonald wrote: Chad Zimmerman wrote: Was just wondering if there is a package out that does multiple file search and replaces? I have to go through my main html directory and make a lot of repetive changes. Was wondering if there was a package or a perl

Re: Multible search and replace?

1997-01-09 Thread Daniel S. Barclay
From: Chad Zimmerman [EMAIL PROTECTED] Was just wondering if there is a package out that does multiple file search and replaces? I have to go through my main html directory and make a lot of repetive changes. Was wondering if there was a package or a perl script laying arround to do this.

Re: Multible search and replace?

1997-01-09 Thread Joey Hess
Was just wondering if there is a package out that does multiple file search and replaces? I have to go through my main html directory and make a lot of repetive changes. Was wondering if there was a package or a perl script laying arround to do this. Would same me the time of writing one

Re: Multible search and replace?

1997-01-09 Thread Craig Sanders
this. Would same me the time of writing one up. sounds like a job for an ed script embedded within a sh script :-) something like: --cut here- #! /bin/sh for i in *.html ; do cat __EOF__ | ed -s $i s/SEARCH/REPLACE/g (and/or any other ed commands you might need here. just about anything

Multible search and replace?

1997-01-08 Thread Chad Zimmerman
Was just wondering if there is a package out that does multiple file search and replaces? I have to go through my main html directory and make a lot of repetive changes. Was wondering if there was a package or a perl script laying arround to do this. Would same me the time of writing one up.