I need to fetch username and password values from sample XML tags
<CommCellUser userName="~!@#$%^&*()_+`1=- 23)()();';" password="":>?<,./;'|}{[] ><:"/" </CommCellUser>
The value will be in double quotes. That value may contain double quotes and any other special characters including spaces .
comm_cell_line=`grep "CommCellUser" /filename | head -1`
userName=`echo "$comm_cell_line" | awk '{print $2}' | cut -d"\"" -f2`
passwd=`echo "$comm_cell_line" | awk '{print $3}' | cut -d"\"" -f2`
Fetching like this miss so many cases. Because it may contain spaces and special characters in value.
Please help .