replace a string containing " with sed
Hello,
could you please tell me how to use sed in the purpose of replacing a string containing " with an other string , exaple: my string is "@id": "45002" i would like to delete all occurence of " and @ and id , finally the output is : 45002 thank's regards |
A string containing " is expressed as
Code:
.*".* Can you be more specific? Do you want to remove all occurrences of " @ i d? |
You might think of looking at it from 2 different points:
1. What you want to get rid (current method) 2. What you want to keep (ie search for the number in the line) Often if you get stuck looking at it from only one point of view you may miss an easier alternative :) |
Something like this?
Code:
# echo '"@id": "45002"' | sed -e 's/["@]//g' |
Code:
echo '"@id": "45002"'|sed -e 's/["a-z@]//g' |
Code:
echo '"@id": "45002"' | sed 's/"\|@\|id//g' Code:
: 45002 |
All times are GMT -5. The time now is 07:13 AM. |