Hi,
My requirement is to get the substring and then remove special character.
Ex
I have data like T_SYSTEM_XXXXX_YYYY_ZZZ
I want to get XXXXXYYYYZZZ
the part after T_SYSTEM is varying it might be XXX_YY or just XX
can you tell me which all commands i have to use.
i understand i have to use AWK here but m still confused.
echo 'T_SYSTEM_XXXXX_YYYY_ZZZ' | sed 's/T_SYSTEM_//'
Hello,
Following may also help.
echo "T_SYSTEM_XXXXX_YYYY_ZZZ" | awk -F"\_" '{print $3 $4 $5}'
Output wil lbe as follows.
XXXXXYYYYZZZ
Thanks,
R. Singh
thanks it worked.
just one more thing it shows a warning when we execute this statement, is there any way to not display the warning.
With a 1993 or later version of the Korn shell or with bash, you could use:
#!/bin/ksh
var="T_SYSTEM_XXXXX_YYYY_ZZZ"
new=${var#T_SYSTEM}
new=${new//_/}
printf "convert %s -> %s\n" "$var" "$new"
which produces:
convert T_SYSTEM_XXXXX_YYYY_ZZZ -> XXXXXYYYYZZZ