orakhan
September 12, 2009, 9:20pm
1
Hi Friends,
I have a script which returns me the following values line by line
ora_smon_RCAT102
oracleKHP102B (DESC
oraclePROOIDDB92 (DES
oraclePMS (DESCRIP
oracleBRIO (LOCAL=N
oracleBRIO (LOCAL=N
oraclePRDB92 (DES
oracleBRIO (LOCAL=N
oracleBRIO (LOCAL=N
oraclePMS (DESCRIP
oracleBRIO (LOCAL=N
oracleBRIO (LOCAL=N
oracleKHP102B (DESC
I need to extract from left all the letters which starts in upper case until it is the end of line or until it finds a space. Looking forward from the experts for a help.
Asad
$
$ cat f2
ora_smon_RCAT102
oracleKHP102B (DESC
oraclePROOIDDB92 (DES
oraclePMS (DESCRIP
oracleBRIO (LOCAL=N
oracleBRIO (LOCAL=N
oraclePRDB92 (DES
oracleBRIO (LOCAL=N
oracleBRIO (LOCAL=N
oraclePMS (DESCRIP
oracleBRIO (LOCAL=N
oracleBRIO (LOCAL=N
oracleKHP102B (DESC
$
$ perl -nle 's/^[^A-Z]+| .*$//g; print' f2
RCAT102
KHP102B
PROOIDDB92
PMS
BRIO
BRIO
PRDB92
BRIO
BRIO
PMS
BRIO
BRIO
KHP102B
$
$
tyler_durden
sed 's/[^A-Z]*\([A-Z0-9]\+\).*/\1/' myfile
orakhan
September 13, 2009, 10:15am
4
Thanks guys, working perfecctly fine
perl -ne '{chomp; print $1,"\n" if /([A-Z][^ ]*(?=( .*)?$))/;}'