Friends,
I have more than 1000 lines in text file which needs to be converted as UPPERCASE by adding _
com.sun.url=www.sun.com
com.ssl.port=808
com.ui.path=/apps/ssi
Expected output
com.sun.url=_COM.SUN.URL_
com.ssl.port=_COM.SSL.PORT_
com.ui.path=_COM.UI.PATH_
Thanks in advance
Bala
Yoda
2
Can you show us what have you tried so far?
I hope this will be useful for you:
awk -F'=' '{printf "%s=_%s_\n",$1,toupper($1)}' file_to_convert.txt
This command is working fine thanx, but the white space also replaced by =__
How can we add the condition to this..
Ensure there is a = character (2 fields)
awk -F'=' 'NF>1 {printf "%s=_%s_\n",$1,toupper($1)}'
Ensure there is a = and no #
awk -F'=' '/^[^#]+=/ {printf "%s=_%s_\n",$1,toupper($1)}'