Assuming that you have a set of files like below
> ls -1 oracle*
oracle_ABC_USER_1.log
oracle_ABC_USER_2.log
oracle_ABC_USER_ADMIN_1.log
oracle_ABC_USER_ADMIN_2.log
oracle_NAME_OF_DB_USER.log
The below perl command should get you the names that you are expecting
> perl -ne ' BEGIN { @files=glob("oracle*.log"); foreach (@files) {s/^oracle_(.*)\.log/_\1/g; print "$_\n"} exit } '
_ABC_USER_1
_ABC_USER_2
_ABC_USER_ADMIN_1
_ABC_USER_ADMIN_2
_NAME_OF_DB_USER
>
Does this help?.
More compact one:
> perl -ne ' BEGIN { s/^oracle_(.*)\.log/_\1/g and print "$_\n" for glob("oracle*.log"); exit}'
_ABC_USER_1
_ABC_USER_2
_ABC_USER_ADMIN_1
_ABC_USER_ADMIN_2
_NAME_OF_DB_USER
>