How to check if the first character of a string is number in bash?

logger

New Member
I am writing an xml element in bash. I need to replace some strings which will start with numbers into something that starts with an character, so it is a valid XML tag (remember xml tags cannot start with alpha numeric characters). For Example,\[code\] str = 192.16.76.52,1001\[/code\]which is not a valid xml tag, i.e i cannot do \[code\]<192.16.76.52,1001>.....</192.16.76.52,1001>\[/code\]So, I am planning to detect if it is a number and replace it with something like\[code\]IP192.16.76.52\[/code\]I know I can do it with IFS, but it might take long time and extra code.Since you know the main problem, feel free to comment or offer suggestions.Thanks
 
Back
Top