I have a XML file with the following structure:
<ns1:ReservationPCC pseudoCityCode="1234" pseudoCityType="Booking" supplierService="Sabre"/>
and I would like to replace the pseudoCityCode by let's say abcd.
I'm trying the following:
sed -e's/pseudoCityCode=.*/pseudoCityCode="abcd" /g'
But, it returns:
<ns1:ReservationPCC pseudoCityCode="abcd"
Adding a white space:
sed -e's/pseudoCityCode=.*\s/pseudoCityCode="abcd" /g'
will return the following:
<ns1:ReservationPCC pseudoCityCode="abcd" supplierService=Sabre/>
Why did the pseudoCityType disappear? What am I missing?
Carlos
sed 's/pseudoCityCode="[^"]*"/pseudoCityCode="abcd"/'<<<'<ns1:ReservationPCC pseudoCityCode="1234" pseudoCityType="Booking" supplierService="Sabre"/>'
or like @Ed Morton said:
sed 's/\(pseudoCityCode="\)[^"]*/\1abcd/'<<<'<ns1:ReservationPCC pseudoCityCode="1234" pseudoCityType="Booking" supplierService="Sabre"/>'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With