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
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 ???......
Search first for "<img src" - check out the grep/egrep/fgrep commands - any line containing that - search for your blank alt="" statement - use a sed command to remove it.
Then run through and insert your new alt="" by searching/replacing border with alt="" border
test it out on a smaller file so you can see if it all works before hitting all your htm/html files.
This pushes the problem outside of what sed can do since we can have a line like:
<img src=this height=10> <img src=that height=10 alt="">
The need to do different operations on two similiar strings on the same line is just too much. Sorry for the bad news.
I wanted a perl script to be done for Password search & replace in two files.
For Example:
Example 1)--i am having a file such as
cat /opt/customer/Ariba/UAT/ariba/app/buyer/Server/config/Parameters.table
Example 2)--and i am having a other file in other location such as cat /opt/customer/home/username/CMStaging/UAT-20080304/AR/ServerFiles/opt/customer/Ariba/UAT/ariba/app/buyer/Server/config/Parameters.table
the example 1 file contains the string as **REPLACE**
the example 2 file contains the live password to be replaced.
i want is it should take the live password from the example 2 file & replace that (**REPLACE**)string with the example 1 file.
can anyone help me out for some code in detailed for the same on a urgent basis..