| OS X - Operating System General OS operation information and support |
| Post Reply | New Thread | Subscribe |
|
|
Thread Tools |
![]() Member Since: Nov 16, 2006
Location: Sheffield, UK
Posts: 97
![]() Mac Specs: MacBook 2.0Ghz Core 2 Duo
|
Hi
As per the title really... I need to go through a few hundred html files and get rid of a line out of the header. I was going to sit down and do this manually, but I thought I'd rather have a tool do it for me (after all, this is what computers are for, aren't they?)... I just need something that can work through a directory full of .htm files and do a find and replace (replacing the line with nothing). Any free tools available? Anything included in the OS that can do this? Your help would be most appreciated ![]() Thanks in advance! Cheers Josh (UK) Fairly Recent Switcher |
| QUOTE Thanks | |
![]() Member Since: Dec 20, 2006
Location: Middletown, Pennsylvania
Posts: 25,917
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Mac Specs: 15" MBP, Core i7/2GHz, 8GB RAM, 256GB Crucial M4 SSD
|
|
| QUOTE Thanks | |
![]() Member Since: Mar 11, 2004
Location: Winnipeg
Posts: 1,964
![]() ![]() ![]() ![]() ![]() ![]() ![]() Mac Specs: G4 — Tiger and OS 9
|
This page, without video, explains it, as well. If Zoom is turned on in the Universal Access control panel/preferences, you can enlarge the video then shrink it by holding down the Control key and sliding the mouse wheel up and down (or use the keyboard). If part of the image enlarges off the screen, drag the mouse from screen edge to screen edge to centre it. You can choose one of the three mouse-dragging actions you might prefer by clicking on the Zoom's Options button. The choices are at the bottom. Last edited by Brown Study; 02-09-2007 at 09:56 AM. |
||||
| QUOTE Thanks | |||||
![]() Member Since: Nov 16, 2006
Location: Sheffield, UK
Posts: 97
![]() Mac Specs: MacBook 2.0Ghz Core 2 Duo
|
I ended up getting a guy at work to write me a VB app to do this... he did it in about 15 minutes and it re-wrote over 100 files in 2 seconds
![]() Shame I had to run it on a PC ![]() (BTW, it wasn't renaming files, it was finding a line of code within a file, then replacing it with some different text). Thanks anyway
Cheers Josh (UK) Fairly Recent Switcher |
| QUOTE Thanks | |
![]() Member Since: Jan 04, 2006
Location: Hamburg, Germany
Posts: 1,385
![]() ![]() ![]() ![]() ![]() ![]() ![]() Mac Specs: MacBook Pro | iMac(2.1 G5) | MacBook(2.16 C2D) | MacMini (1.67 CD) | iPhone 4 | iPad (3rd Gen)
|
![]() 1)Open Terminal.App (/Applications/Utilities/Terminal) 2)cd to the directory where you have all the html files (eg. cd ~/Sites/Mywebsite/) 3)type find -type f | xargs perl -pi -e 's/<String you want to replace>/<String you want to be replaced with>/g' and hit enter. (eg. find /Users/novicew/newsite/ -type f | xargs perl -pi -e 's/blablabla/blabla/g') You can also define the specific file type you want the system to search as follows. find /Users/novicew/newsite/ -type f | xargs perl -pi -e 's/blablabla/blabla/g' *.html Possibilities are endless, you just need to find them
Last edited by novicew; 02-09-2007 at 05:50 PM. |
| QUOTE Thanks | |
![]() Member Since: Mar 30, 2004
Location: USA
Posts: 4,744
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Mac Specs: 12" Apple PowerBook G4 (1.5GHz)
|
The easy way....
Open TextWrangler (It's free. Google it. If you're editing HTML, you should have it anyway.) Choose Search > Find Enter the text you want to search for in the top field Enter the replacement text in the second field Check the Multi-File Search checkbox at the bottom of the window. Click the Other... button. A file-chooser dialog will open. Choose the folder that all of these files are in Click Replace All In the next dialog box, Decide whether you'd like the modified files to be opened (so you can review and save them individually) or saved as soon as the changes are made. Then click Proceed. And you're done. |
| QUOTE Thanks | |
| Post Reply | New Thread | Subscribe |
| Thread Tools | |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
|
|||||||
All times are GMT -4. The time now is 04:57 AM.
Powered by vBulletin