Search Results

Search: Posts Made By: tobbe
14,213
Posted By tobbe
Can someone please explain this?
echo "&test &" | perl -ane '$_ =~ s/(&)([^amp;|^quot;])/$1amp;$2/ig;print'

&test & :mad:



echo "&best &" | perl -ane '$_ =~ s/(&)([^amp;|^quot;])/$1amp;$2/ig;print'

&best & ...
14,213
Posted By tobbe
Thanks! That works OK: echo "AB...
Thanks!
That works OK:

echo "AB &CD&EF" | sed -e 's/\&\([^\amp;]\)/\&\1/'
AB &CD&EF
14,213
Posted By tobbe
OK thanks for the advice. In perl the content...
OK thanks for the advice.
In perl the content of the parenthesis are: $1, $2 etc.
What is the syntax like in sed?

/T
14,213
Posted By tobbe
same result with escaped "&"
sed -e 's/\&[^amp;|^apos;|^quot;|^lt;|^gt;]/\&/gi' input.xml

<xml>
<source> &quot; One &quot; </source>
<name>test &amp; test</name>
<last>test2&amp;test2</last>
<address>test3 &apos; test3</address>
<area>...
14,213
Posted By tobbe
Simple sed one-liner for fixing unencoded ampersands
Hi,
I recieve some XML-files that constantly has bad encoded content. There are Ampersands that are not encoded correctly causing my XML-parser to halt.
I wrote a sed one-liner to fix any stand...
Showing results 1 to 5 of 5

 
All times are GMT -4. The time now is 07:19 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy