Tools for searching and replacing code

R

Robert

I have many sites with individual css, javascript, and html code.
Sometimes, I find myself updating multiple CSS files for different
sites on my hard drive. Do any tools exist for changing code across
multiple sites including CSS, HTML, and JavaScript with regular
expression support? For example, I would like to change margins (from
6px to 60px) in the body elements for 30 CSS files. The ideal tool
would allow me to select a directory (& subfolders), search for the
text files (CSS HTML, JavaScript, etc), and replace the code.

I would appreciate any recommendations.
 
J

Jeffrey Silverman

I have many sites with individual css, javascript, and html code.
Sometimes, I find myself updating multiple CSS files for different
sites on my hard drive. Do any tools exist for changing code across
multiple sites including CSS, HTML, and JavaScript with regular
expression support? For example, I would like to change margins (from
6px to 60px) in the body elements for 30 CSS files. The ideal tool
would allow me to select a directory (& subfolders), search for the
text files (CSS HTML, JavaScript, etc), and replace the code.

I would appreciate any recommendations.

perl -pie 's/6px/60px/' *.css */*.css */*/*.css

That oughtta do it. I'm gonna get some flak as to why this solution is
not flexible enough or easy enough to use, bu I have retorts for all
complaints.

later...
 
P

Peter - nativespace hosting

Robert said:
I have many sites with individual css, javascript, and html code.
Sometimes, I find myself updating multiple CSS files for different
sites on my hard drive. Do any tools exist for changing code across
multiple sites including CSS, HTML, and JavaScript with regular
expression support? For example, I would like to change margins (from
6px to 60px) in the body elements for 30 CSS files. The ideal tool
would allow me to select a directory (& subfolders), search for the
text files (CSS HTML, JavaScript, etc), and replace the code.

I would appreciate any recommendations.

Textpad has some excellent search and replace facilities, using regular
expressions - use the 'Find In Files CTRL+F5' function (remember to tick
'Include Subfolders') to do what you want.
HTH
 
J

Jeffrey Silverman

Ooh! A challenge! Here's one for you then;

"My bus to work was late this morning."

Retort away ;-)

Hah! That's easy.

If you're gonna be late anyways, then stop by the bagel store and pick me
up a regular coffee and a sesame bagel, light cream cheese. And maybe a
newspaper.
 
R

Robert

Hah! That's easy.

If you're gonna be late anyways, then stop by the bagel store and pick me
up a regular coffee and a sesame bagel, light cream cheese. And maybe a
newspaper.


Retort…hmm…You have given a man fish for the day and he thanks you;
teach a man to fish and he'll be indebted to you for he will not go
hungry.

Perl sound great, yet I am less familiar with the related tools and
compilers. Could you give me more insight on learning this stuff for
practical use? In addition, my request extends to searching blocks of
text like paragraphs and entire class selectors.

I just began familiarize myself with Dreamweaver's Find and Replace
extension engine (2004). It has regular expression support and one
could save searches. Now, I have figure out searching in folders and
compiling a search list (hmm ponders a Google search).

Entertain us with leading a man to the ocean or help us clean our
catch and prepare for the next day. Unti then, I'll see you at the
docks another day for fish.
 
N

Neal

Robert said:
Retort…hmm…You have given a man fish for the day and he thanks you;
teach a man to fish and he'll be indebted to you for he will not go
hungry.

Or..

Give a man a fish, he eats today. Teach a man to fish, he has an excuse to
drink beer in a boat at 5 AM.
 
R

Robert

Textpad has some excellent search and replace facilities, using regular
expressions - use the 'Find In Files CTRL+F5' function (remember to tick
'Include Subfolders') to do what you want.
HTH

I forgot about Textpad, one of my favorite applications. The regular
expression support is not ideal, yet if I could compile search and
replace list, then it could be workable. Let me know if you have any
additional insights.

In addition, my request extends to searching blocks of text like
paragraphs and entire class selectors.

I just began familiarize myself with Dreamweaver's Find and Replace
extension engine (2004). It has regular expression support and one
could save searches. Now, I have figure out searching in folders and
compiling a search list (hmm ponders a Google search).
 
S

Spartanicus

Robert said:
I forgot about Textpad, one of my favorite applications. The regular
expression support is not ideal, yet if I could compile search and
replace list, then it could be workable. Let me know if you have any
additional insights.
In addition, my request extends to searching blocks of text like
paragraphs and entire class selectors.

Homesite has a multi line, multi file or directory wide S&R, it also
supports regexps albeit in a limited fashion.

Alternatively you could look at TextPipe.
 
N

nice.guy.nige

While the city slept, Jeffrey Silverman ([email protected]) feverishly
typed...
Hah! That's easy.

If you're gonna be late anyways, then stop by the bagel store and
pick me up a regular coffee and a sesame bagel, light cream cheese.
And maybe a newspaper.

Damn! You're good! ;-)

Cheers,
Nige
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top