![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Replace text in multiple files | on9west | Shell Programming and Scripting | 1 | 05-20-2008 02:35 AM |
| Find and replace files in multiple folders | lodey | Shell Programming and Scripting | 6 | 09-28-2007 03:00 AM |
| How can I replace multiple lines from different files | ranga27 | Shell Programming and Scripting | 2 | 02-07-2007 08:57 PM |
| Replace text in match files | wilsonchan1000 | UNIX for Dummies Questions & Answers | 1 | 12-16-2002 09:21 AM |
| grep multiple text files in folder into 1 text file? | coppertone | UNIX for Dummies Questions & Answers | 7 | 08-23-2002 03:50 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Replace text in multiple files
Ok guys,
If anyone could help me out on this puppy I'd be very appreciative! Here's the scenario I have a string for example : <img src=BLANK_IMG border=0 width=221 height=12> or <img src=IMG border=0 height=12 width=221 > or anything else really.... need to basically change each one to include alt="" <img src=IMG alt="" .....yada yada....... > Every line I need to change is guaranteed to start with "<img" and end with a ">" (of course..) the rest is variable. Also...for bonus points !!! Those <img tags that DO have the alt="" line already, but in a different position, I want to MOVE IT to be next to the src eg move <img src=IMG border=0 height=12 width=221 alt=""> to <img src=IMG alt="" border=0 height=12 width=221> Any ideas? Thanks! |
|
|||||
|
See this posting with the same type of question - should start you off in the right direction.
|
|
||||
|
Thanks RTM, I saw that posting but that's just a straightforward find/replace statement - I need something that uses a fair bit of logic!
If a super-human sed statement can do it then great! Otherwise it may be a case of writing a program to read word by word, character by charater until it matches a "<img>" then read ahead until ">" ...manipulate the line, then spit it out... or something like that ???...... Of course....I welcome any other *simpler* ideas! ![]() |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|