Pattern Matching

Hi Folks,

I have the following requirement:
I have a file that is containing numerous queries. The tables name mentioned in the queries are in the following format : SchemaName.Tablename. e.g COPDB.TableName.

I need to take out all the COPDB.TableName pattern and write it to a different file.
Note: Only the COPDB.TableName pattern.

Thanks in Advance.

Please be aware that double-posting/bumping up of posts is against the rules of the forum. You already have 3 such violations. One more and you will be banned temporarily.

Hi can you send me a sample input file and a expected output, Its not clear here

Suppose my input File is as follows:

Locking for access COPDB.T1
insert into COPDB.T2 select * from COPDB.T5
update COPBD.T3 set................
insert into COPDB.T7 select * from COPDB.T12
update COPBD.T71 set................

My requirement is to get:
COPDB.T1
COPDB.T2
COPDB.T5
COPDB.T3
COPDB.T7
COPDB.T12
COPDB.T71

perl -ne 'print $1."\n" while /(COPDB\.T\d+)/g;' input.txt

[LEFT]Thanks for the reply.
But this script is fetching all the words after that Pattern.
[/LEFT]
For example if my input is :

LOCKING TABLE COPDB.cop_program_run_detail FOR ACCESS

this script is getting :
COPDB.cop_program_run_detail FOR ACCESS
But I want only COPDB.TableName
i.e COPDB.cop_program_run_detail .
And one more thing its not necessary that the Table name starts with T.

$ cat infile
Locking for access COPDB.T1
insert into COPDB.T2 select * from COPDB.T5
update COPDB.T3 set................
insert into COPDB.T7 select * from COPDB.T12
update COPDB.T71 set................
$ sed 's/\(COPDB\.[a-zA-Z0-9_]*\)/\
> \1\
> /g' infile|grep '^COPDB'
COPDB.T1
COPDB.T2
COPDB.T5
COPDB.T3
COPDB.T7
COPDB.T12
COPDB.T71