
phamou
Novice
Jun 13, 2008, 2:09 PM
Views: 1194
|
|
Special Extraction requirement...
|
|
|
Hi, I have a very special text extraction requirement, see the sample text below: ====================================================================== [15:39:36.873] dal.oracle.connection Bindings: :1 char: Config (6) :2 char: Vend (4) [15:39:36.877] dal.connection_impl SQL: {00:00:00.004236 us} {SELECT SW_Key_Nm, Config_Value FROM SW_Config c, SW_Key k, SW_Section s, SW_Object o WHERE c.SW_Object_Id=o.SW_Object_Id AND c.SW_Section_Id=s.SW_Section_Id AND c.SW_Key_Id=k.SW_Key_Id AND k.SW_Object_Id=o.SW_Object_Id AND k.SW_Section_Id=s.SW_Section_Id AND s.SW_Object_Id=o.SW_Object_Id AND s.SW_Section_Nm LIKE :1 AND o.SW_Object_Nm LIKE :2} [15:39:36.885] dal.oracle.connection Bindings: :1 char: ConfigDC (8) :2 char: Vend (4) [15:39:36.887] dal.connection_impl SQL: {00:00:00.002197 us} {SELECT SW_Key_Nm, Config_Value FROM SW_Config c, SW_Key k, SW_Section s, SW_Object o WHERE c.SW_Object_Id=o.SW_Object_Id AND c.SW_Section_Id=s.SW_Section_Id AND c.SW_Key_Id=k.SW_Key_Id AND k.SW_Object_Id=o.SW_Object_Id AND k.SW_Section_Id=s.SW_Section_Id AND s.SW_Object_Id=o.SW_Object_Id AND s.SW_Section_Nm LIKE :1 AND o.SW_Object_Nm LIKE :2} [15:39:36.942] dal.oracle.connection Bindings: :1 char: HT (2) [15:39:36.945] dal.connection_impl SQL: {00:00:00.054701 us} {SELECT Device_Id, Device_Nm FROM Device WHERE Device_Type_Cd=:1} [15:39:36.947] dal.oracle.connection Bindings: :1 long: 2 (4) :2 long: 1 (4) [15:39:36.949] dal.connection_impl SQL: {00:00:00.001932 us} {SELECT TL_Comm_IP, TL_Comm_Port, TL_Comm_Timeout, Connectivity_Status_Cd FROM Connectivity WHERE Host_Id=:1 AND Route_Seq_No=:2} [15:39:36.952] dal.connection_impl SQL: {00:00:00.001662 us} {SELECT COUNT(*) AS Total FROM NCR_Data_Collection} [15:39:36.977] dal.oracle.connection Bindings: :1 char: Encryption (10) :2 char: Vend (4) ====================================================================== I need to extract all of the SQL statements, they all start with the following regular expression: SQL: \{[0-9]*\:[0-9]*\:[0-9]*\.[0-9]* [a-zA-Z0-9]*\} \{ but can spawn for a different number of lines until the next "}" I would like to extract those SQL statements and push them into a different file. any help would be greatly appreciated !! best regards, Patrick Hamou www.renaps.com
(This post was edited by phamou on Jun 13, 2008, 2:10 PM)
|