![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | batch replace href value I've got a big html page.Now I want to batch replace href value of it. The file as follow: <TR> <TD vAlign=center align=middle bgColor=#ffffff height=25><A href=" 0793.asp?id=86" target=_blank>######</A></TD> <TD vAlign=center align=middle bgColor=#ffffff><FONT color=#ff0000>####</FONT></TD> <TD vAlign=center align=middle bgColor=#ffffff>http://www.******.com/</TD></TR> <TR> <TR> <TD vAlign=center align=middle bgColor=#ffffff height=25><A href=" 0794.asp?id=87" target=_blank>######</A></TD> <TD vAlign=center align=middle bgColor=#ffffff><FONT color=#ff0000>#####</FONT></TD> <TD vAlign=center align=middle bgColor=#ffffff>http://www.xxxxx.com/</TD></TR> <TR> I want to replace the value like this: 0793.asp?id=86 ---- http://www.******.com/ 0794.asp?id=87 ---- http://www.xxxxx.com/ The e.g is just part of the page, the hrefs and urls is different. If I use copy and paste it'll be a hard task.Could sombody help me please? |
My System Specs![]() |
| | #2 (permalink) |
| | Re: batch replace href value "buddy" <buddy.qin@xxxxxx> wrote in message news:db126f5b-3c60-4077-80b2-e0777112bb91@xxxxxx Quote: > I've got a big html page.Now I want to batch replace href value of it. > The file as follow: > > <TR> > <TD vAlign=center align=middle bgColor=#ffffff height=25><A > href=" 0793.asp?id=86" target=_blank>######</A></TD> > <TD vAlign=center align=middle bgColor=#ffffff><FONT > color=#ff0000>####</FONT></TD> > <TD vAlign=center align=middle > bgColor=#ffffff>http://www.******.com/</TD></TR> > <TR> > <TR> > <TD vAlign=center align=middle bgColor=#ffffff height=25><A > href=" 0794.asp?id=87" target=_blank>######</A></TD> > <TD vAlign=center align=middle bgColor=#ffffff><FONT > color=#ff0000>#####</FONT></TD> > <TD vAlign=center align=middle > bgColor=#ffffff>http://www.xxxxx.com/</TD></TR> > <TR> > > I want to replace the value like this: > > 0793.asp?id=86 ---- http://www.******.com/ > 0794.asp?id=87 ---- http://www.xxxxx.com/ > > The e.g is just part of the page, the hrefs and urls is different. If > I use copy and paste it'll be a hard task.Could sombody help me please? |
My System Specs![]() |
| | #3 (permalink) |
| | Re: batch replace href value On Sep 9, 9:18*pm, "Pegasus [MVP]" <n...@xxxxxx> wrote: Quote: > "buddy" <buddy....@xxxxxx> wrote in message > > news:db126f5b-3c60-4077-80b2-e0777112bb91@xxxxxx > > > Quote: > > I've got a big html page.Now I want to batch replace href value of it. > > The file as follow: Quote: > > <TR> > > * *<TD vAlign=center align=middle bgColor=#ffffff height=25><A > > * * *href=" 0793.asp?id=86" target=_blank>######</A></TD> > > * *<TD vAlign=center align=middle bgColor=#ffffff><FONT > > * * *color=#ff0000>####</FONT></TD> > > * *<TD vAlign=center align=middle > > bgColor=#ffffff>http://www.******.com/</TD></TR> > > <TR> > > <TR> > > * *<TD vAlign=center align=middle bgColor=#ffffff height=25><A > > * * *href=" 0794.asp?id=87" target=_blank>######</A></TD> > > * *<TD vAlign=center align=middle bgColor=#ffffff><FONT > > * * *color=#ff0000>#####</FONT></TD> > > * *<TD vAlign=center align=middle > > bgColor=#ffffff>http://www.xxxxx.com/</TD></TR> > > <TR> Quote: > > I want to replace the value like this: Quote: Quote: > > The e.g is just part of the page, the hrefs and urls is different. If > > I use copy and paste it'll be a hard task.Could sombody help me please? > For a single file the most efficient solution would be to use notepad.exe.. notepad.exe will be slowly. |
My System Specs![]() |
| | #4 (permalink) |
| | Re: batch replace href value buddy wrote: Quote: > On Sep 9, 9:18 pm, "Pegasus [MVP]" <n...@xxxxxx> wrote: Quote: >> "buddy" <buddy....@xxxxxx> wrote in message >> >> news:db126f5b-3c60-4077-80b2-e0777112bb91@xxxxxx >> >> >> Quote: >>> I've got a big html page.Now I want to batch replace href value of >>> it. The file as follow: Quote: >>> <TR> >>> <TD vAlign=center align=middle bgColor=#ffffff height=25><A >>> href=" 0793.asp?id=86" target=_blank>######</A></TD> >>> <TD vAlign=center align=middle bgColor=#ffffff><FONT >>> color=#ff0000>####</FONT></TD> >>> <TD vAlign=center align=middle >>> bgColor=#ffffff>http://www.******.com/</TD></TR> >>> <TR> >>> <TR> >>> <TD vAlign=center align=middle bgColor=#ffffff height=25><A >>> href=" 0794.asp?id=87" target=_blank>######</A></TD> >>> <TD vAlign=center align=middle bgColor=#ffffff><FONT >>> color=#ff0000>#####</FONT></TD> >>> <TD vAlign=center align=middle >>> bgColor=#ffffff>http://www.xxxxx.com/</TD></TR> >>> <TR> Quote: >>> I want to replace the value like this: Quote: Quote: >>> The e.g is just part of the page, the hrefs and urls is different. >>> If I use copy and paste it'll be a hard task.Could sombody help me >>> please? >> For a single file the most efficient solution would be to use >> notepad.exe. > Thanks Pegasus!But there's over 1000 urls must be replaced, if using > notepad.exe will be slowly. alt.msdos.batch.nt ? Your query is far too vague. If, for instance, you wish to replace " 0793.asp?id=86" with http://www.sevenninethree.com then executing from the prompt for %i in (*.html) do sed -frepl.txt <%i >%i.rep Where: + your source files are *.html + SED is the well-known SED utility (I use HHSED - google is your friend (g)awk is a utility with similar functionality, preferred by some) + *.rep will be generated + the replacements are read from a file repl.txt, which is formatted as lines like s#\x22\x200793.asp?id=86\x22#\x22http://www.sevenninethree.com\x22# Which reads "substitute for the first string between '#' with the second string" and \xnn means 'hex-nn' to replace certain characters that may have meaning to the utility in question. I used '#', but any character could be used provided it does not appear in the target or substitute string. (all this would be in the SED (etc) documentation) s#\x22\x200793.asp?id=86\x22#\x22http://www.sevenninethree.com\x22# |
My System Specs![]() |
| | #5 (permalink) |
| | Re: batch replace href value buddy wrote: Quote: > On Sep 9, 9:18 pm, "Pegasus [MVP]" <n...@xxxxxx> wrote: Quote: >> "buddy" <buddy....@xxxxxx> wrote: >> Quote: >>> I've got a big html page.Now I want to batch replace href value of >>> it. The file as follow: Quote: >>> <TR> >>> <TD vAlign=center align=middle bgColor=#ffffff height=25><A >>> href=" 0793.asp?id=86" target=_blank>######</A></TD> >>> <TD vAlign=center align=middle bgColor=#ffffff><FONT >>> color=#ff0000>####</FONT></TD> >>> <TD vAlign=center align=middle >>> bgColor=#ffffff>http://www.******.com/</TD></TR> >>> <TR> >>> <TR> >>> <TD vAlign=center align=middle bgColor=#ffffff height=25><A >>> href=" 0794.asp?id=87" target=_blank>######</A></TD> >>> <TD vAlign=center align=middle bgColor=#ffffff><FONT >>> color=#ff0000>#####</FONT></TD> >>> <TD vAlign=center align=middle >>> bgColor=#ffffff>http://www.xxxxx.com/</TD></TR> >>> <TR> Quote: >>> I want to replace the value like this: Quote: Quote: >>> The e.g is just part of the page, the hrefs and urls is different. >>> If I use copy and paste it'll be a hard task.Could sombody help me >>> please? >> For a single file the most efficient solution would be to use >> notepad.exe. > Thanks Pegasus!But there's over 1000 urls must be replaced, if using > notepad.exe will be slowly. while waiting for replys. <shrug> -- Todd Vargo (Post questions to group only. Remove "z" to email personal messages) |
My System Specs![]() |
| | #6 (permalink) |
| | Re: batch replace href value "buddy" <buddy.qin@xxxxxx> wrote in message news:56db2f5b-55f1-4c8c-83b2-7f8f7b502466@xxxxxx On Sep 9, 9:18 pm, "Pegasus [MVP]" <n...@xxxxxx> wrote: Quote: > "buddy" <buddy....@xxxxxx> wrote in message > > news:db126f5b-3c60-4077-80b2-e0777112bb91@xxxxxx > > > Quote: > > I've got a big html page.Now I want to batch replace href value of it. > > The file as follow: Quote: > > <TR> > > <TD vAlign=center align=middle bgColor=#ffffff height=25><A > > href=" 0793.asp?id=86" target=_blank>######</A></TD> > > <TD vAlign=center align=middle bgColor=#ffffff><FONT > > color=#ff0000>####</FONT></TD> > > <TD vAlign=center align=middle > > bgColor=#ffffff>http://www.******.com/</TD></TR> > > <TR> > > <TR> > > <TD vAlign=center align=middle bgColor=#ffffff height=25><A > > href=" 0794.asp?id=87" target=_blank>######</A></TD> > > <TD vAlign=center align=middle bgColor=#ffffff><FONT > > color=#ff0000>#####</FONT></TD> > > <TD vAlign=center align=middle > > bgColor=#ffffff>http://www.xxxxx.com/</TD></TR> > > <TR> Quote: > > I want to replace the value like this: Quote: Quote: > > The e.g is just part of the page, the hrefs and urls is different. If > > I use copy and paste it'll be a hard task.Could sombody help me please? > For a single file the most efficient solution would be to use notepad.exe. notepad.exe will be slowly. ============== Have a cup of coffee while notepad performs the job! |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| batch replace href value | VB Script | |||
| batch file / script to replace information | VB Script | |||
| Fetch special characters like "Ñ" and absolute URL from href attribute of anchors | VB Script | |||
| find all href attributes | PowerShell | |||
| href Links & Junk Mail | Vista mail | |||