I would like to catch the following pattern:
A substring in the file beginning with the pattern "Importing file" and
ending with the pattern "Modified.*rows in.*table", possibly spanning
multiple lines provided that it contains the string Exception. The
substring should not contain the beginning or ending patterns more than
once...
The following command almost works, except that it may return strings
that contain "Importing file" multiple times:
perl -0777ne "print m!Importing
file[\s\S]*?Exception[\s\S]*?Modified.*table!g;" test.txt
Does anyone know what changes I could make to the regular expression so
that it prints out the correct pattern?
I've attached a small test document for anyone wanting to test out ideas.
Thanks,
Omair
<message priority="info"><![CDATA[Importing file:
C:\cruisecontrol-projects\checkout\1-DEVL\Java\..\ApplicationData\QA\StandardData\2-AC_VIOLATION.xml]]></message>
<message priority="info"><![CDATA[7047 [main] INFO
com.workbrain.util.DataLoader - Modified 21 rows in AC_VIOLATION
table.]]></message>
<message priority="info"><![CDATA[Modified 21 rows in AC_VIOLATION
table.]]></message>
<message priority="info"><![CDATA[Importing file:
C:\cruisecontrol-projects\checkout\1-DEVL\Java\..\ApplicationData\QA\StandardData\2-DOCKET.xml]]></message>
<message priority="info"><![CDATA[7110 [main] INFO
com.workbrain.util.DataLoader - Modified 5 rows in DOCKET table.]]></message>
<message priority="info"><![CDATA[Modified 5 rows in DOCKET table.]]></message>
<message priority="info"><![CDATA[Importing file:
C:\cruisecontrol-projects\checkout\1-DEVL\Java\..\ApplicationData\QA\StandardData\2-SHIFT.xml]]></message>
<message priority="info"><![CDATA[7266 [main] INFO
com.workbrain.util.DataLoader - Modified 63 rows in SHIFT table.]]></message>
<message priority="info"><![CDATA[Modified 63 rows in SHIFT table.]]></message>
<message priority="info"><![CDATA[Importing file:
C:\cruisecontrol-projects\checkout\1-DEVL\Java\..\ApplicationData\QA\StandardData\2-TIME_CODE.xml]]></message>
<message priority="info"><![CDATA[7469 [main] WARN
com.workbrain.tool.jdbc.proxy.ProxyPreparedStatement - Commit timeout or other
SQLException.]]></message>
<message priority="info"><![CDATA[java.sql.SQLException: ORA-00001: unique
constraint (WORKBRAIN.UK_TMOD_TCODE_NAME) violated]]></message>
<message priority="info"><![CDATA[at
oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)]]></message>
<message priority="info"><![CDATA[at
oracle.jdbc.oci8.OCIDBAccess.check_error(OCIDBAccess.java:2355)]]></message>
<message priority="info"><![CDATA[at
oracle.jdbc.oci8.OCIDBAccess.executeFetch(OCIDBAccess.java:1760)]]></message>
<message priority="info"><![CDATA[at
oracle.jdbc.oci8.OCIDBAccess.parseExecuteFetch(OCIDBAccess.java:1921)]]></message>
<message priority="info"><![CDATA[at
oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2152)]]></message>
<message priority="info"><![CDATA[at
oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:2035)]]></message>
<message priority="info"><![CDATA[at
oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2864)]]></message>
<message priority="info"><![CDATA[at
oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:609)]]></message>
<message priority="info"><![CDATA[at
com.workbrain.tool.jdbc.proxy.ProxyPreparedStatement.executeUpdate(ProxyPreparedStatement.java:179)]]></message>
<message priority="info"><![CDATA[at
com.workbrain.util.RowPersister.insert(RowPersister.java:398)]]></message>
<message priority="info"><![CDATA[at
com.workbrain.util.DataLoader.importATable(DataLoader.java:474)]]></message>
<message priority="info"><![CDATA[at
com.workbrain.util.DataLoader.importData(DataLoader.java:371)]]></message>
<message priority="info"><![CDATA[at
com.workbrain.util.DataLoader.importAFile(DataLoader.java:309)]]></message>
<message priority="info"><![CDATA[at
com.workbrain.util.DataLoader.importXml(DataLoader.java:188)]]></message>
<message priority="info"><![CDATA[at
com.workbrain.util.DataLoader.main(DataLoader.java:766)]]></message>
<message priority="info"><![CDATA[Commit timeout or other
SQLException.]]></message>
<message priority="info"><![CDATA[java.sql.SQLException: ORA-00001: unique
constraint (WORKBRAIN.UK_TMOD_TCODE_NAME) violated]]></message>
<message priority="info"><![CDATA[at
oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)]]></message>
<message priority="info"><![CDATA[at
oracle.jdbc.oci8.OCIDBAccess.check_error(OCIDBAccess.java:2355)]]></message>
<message priority="info"><![CDATA[at
oracle.jdbc.oci8.OCIDBAccess.executeFetch(OCIDBAccess.java:1760)]]></message>
<message priority="info"><![CDATA[at
oracle.jdbc.oci8.OCIDBAccess.parseExecuteFetch(OCIDBAccess.java:1921)]]></message>
<message priority="info"><![CDATA[at
oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2152)]]></message>
<message priority="info"><![CDATA[at
oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:2035)]]></message>
<message priority="info"><![CDATA[at
oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2864)]]></message>
<message priority="info"><![CDATA[at
oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:609)]]></message>
<message priority="info"><![CDATA[at
com.workbrain.tool.jdbc.proxy.ProxyPreparedStatement.executeUpdate(ProxyPreparedStatement.java:179)]]></message>
<message priority="info"><![CDATA[at
com.workbrain.util.RowPersister.insert(RowPersister.java:398)]]></message>
<message priority="info"><![CDATA[at
com.workbrain.util.DataLoader.importATable(DataLoader.java:474)]]></message>
<message priority="info"><![CDATA[at
com.workbrain.util.DataLoader.importData(DataLoader.java:371)]]></message>
<message priority="info"><![CDATA[at
com.workbrain.util.DataLoader.importAFile(DataLoader.java:309)]]></message>
<message priority="info"><![CDATA[at
com.workbrain.util.DataLoader.importXml(DataLoader.java:188)]]></message>
<message priority="info"><![CDATA[at
com.workbrain.util.DataLoader.main(DataLoader.java:766)]]></message>
<message priority="info"><![CDATA[7469 [main] ERROR
com.workbrain.util.RowPersister - On inserting into TIME_CODE with ID: 50338
received the error:]]></message>
<message priority="info"><![CDATA[ORA-00001: unique constraint
(WORKBRAIN.UK_TMOD_TCODE_NAME) violated]]></message>
<message priority="info"><![CDATA[while executing INSERT INTO TIME_CODE
(TCODE_ID,TCODE_NAME,TCODE_DESC,TCODE_DEF_HOURS,TCODE_DOW,TCODE_OWS,COLR_ID,HTYPE_ID,TCODE_UNAUTHORIZE,TCODE_FLAG1,TCODE_FLAG2,TCODE_FLAG3,TCODE_FLAG4,TCODE_FLAG5,TCODE_FLAG6,TCODE_FLAG7,TCODE_FLAG8,TCODE_FLAG9,TCODE_FLAG10,TCODE_SORTORDER,TCODE_YAG,TCODE_AFFECTS_BALANCES,TCODE_IRREGULAR,TCODE_DEFAULT_RATE,TCODE_SUMMARIZE,TCODE_ETM_WD_HIDE,LMS_ID,CLIENT_ID,TCODE_IS_LTA,TCODE_UDF1,TCODE_UDF2,TCODE_UDF3,TCODE_UDF4,TCODE_UDF5,TCODE_UDF6,TCODE_UDF7,TCODE_UDF8,TCODE_UDF9,TCODE_UDF10,TCODE_RPT_ISPRDCTV,TCODE_IS_EXCLD_TTL)
VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
Parameters
(50338,FMLA,null,null,YYYYYYY,N,14,0,N,null,null,null,null,null,null,null,null,null,null,9999,null,Y,null,null,Y,N,1,1,N,null,null,null,null,null,null,null,null,null,null,N,null)]]></message>
<message priority="info"><![CDATA[[SQL] INSERT INTO TIME_CODE
(TCODE_ID,TCODE_NAME,TCODE_DESC,TCODE_DEF_HOURS,TCODE_DOW,TCODE_OWS,COLR_ID,HTYPE_ID,TCODE_UNAUTHORIZE,TCODE_FLAG1,TCODE_FLAG2,TCODE_FLAG3,TCODE_FLAG4,TCODE_FLAG5,TCODE_FLAG6,TCODE_FLAG7,TCODE_FLAG8,TCODE_FLAG9,TCODE_FLAG10,TCODE_SORTORDER,TCODE_YAG,TCODE_AFFECTS_BALANCES,TCODE_IRREGULAR,TCODE_DEFAULT_RATE,TCODE_SUMMARIZE,TCODE_ETM_WD_HIDE,LMS_ID,CLIENT_ID,TCODE_IS_LTA,TCODE_UDF1,TCODE_UDF2,TCODE_UDF3,TCODE_UDF4,TCODE_UDF5,TCODE_UDF6,TCODE_UDF7,TCODE_UDF8,TCODE_UDF9,TCODE_UDF10,TCODE_RPT_ISPRDCTV,TCODE_IS_EXCLD_TTL)
VALUES('50338','FMLA',null,null,'YYYYYYY','N','14','0','N',null,null,null,null,null,null,null,null,null,null,'9999',null,'Y',null,null,'Y','N','1','1','N',null,null,null,null,null,null,null,null,null,null,'N',null)]]></message>
<message priority="info"><![CDATA[On inserting into TIME_CODE with ID: 50338
received the error:]]></message>
<message priority="info"><![CDATA[ORA-00001: unique constraint
(WORKBRAIN.UK_TMOD_TCODE_NAME) violated]]></message>
<message priority="info"><![CDATA[while executing INSERT INTO TIME_CODE
(TCODE_ID,TCODE_NAME,TCODE_DESC,TCODE_DEF_HOURS,TCODE_DOW,TCODE_OWS,COLR_ID,HTYPE_ID,TCODE_UNAUTHORIZE,TCODE_FLAG1,TCODE_FLAG2,TCODE_FLAG3,TCODE_FLAG4,TCODE_FLAG5,TCODE_FLAG6,TCODE_FLAG7,TCODE_FLAG8,TCODE_FLAG9,TCODE_FLAG10,TCODE_SORTORDER,TCODE_YAG,TCODE_AFFECTS_BALANCES,TCODE_IRREGULAR,TCODE_DEFAULT_RATE,TCODE_SUMMARIZE,TCODE_ETM_WD_HIDE,LMS_ID,CLIENT_ID,TCODE_IS_LTA,TCODE_UDF1,TCODE_UDF2,TCODE_UDF3,TCODE_UDF4,TCODE_UDF5,TCODE_UDF6,TCODE_UDF7,TCODE_UDF8,TCODE_UDF9,TCODE_UDF10,TCODE_RPT_ISPRDCTV,TCODE_IS_EXCLD_TTL)
VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
Parameters
(50338,FMLA,null,null,YYYYYYY,N,14,0,N,null,null,null,null,null,null,null,null,null,null,9999,null,Y,null,null,Y,N,1,1,N,null,null,null,null,null,null,null,null,null,null,N,null)]]></message>
<message priority="info"><![CDATA[[SQL] INSERT INTO TIME_CODE
(TCODE_ID,TCODE_NAME,TCODE_DESC,TCODE_DEF_HOURS,TCODE_DOW,TCODE_OWS,COLR_ID,HTYPE_ID,TCODE_UNAUTHORIZE,TCODE_FLAG1,TCODE_FLAG2,TCODE_FLAG3,TCODE_FLAG4,TCODE_FLAG5,TCODE_FLAG6,TCODE_FLAG7,TCODE_FLAG8,TCODE_FLAG9,TCODE_FLAG10,TCODE_SORTORDER,TCODE_YAG,TCODE_AFFECTS_BALANCES,TCODE_IRREGULAR,TCODE_DEFAULT_RATE,TCODE_SUMMARIZE,TCODE_ETM_WD_HIDE,LMS_ID,CLIENT_ID,TCODE_IS_LTA,TCODE_UDF1,TCODE_UDF2,TCODE_UDF3,TCODE_UDF4,TCODE_UDF5,TCODE_UDF6,TCODE_UDF7,TCODE_UDF8,TCODE_UDF9,TCODE_UDF10,TCODE_RPT_ISPRDCTV,TCODE_IS_EXCLD_TTL)
VALUES('50338','FMLA',null,null,'YYYYYYY','N','14','0','N',null,null,null,null,null,null,null,null,null,null,'9999',null,'Y',null,null,'Y','N','1','1','N',null,null,null,null,null,null,null,null,null,null,'N',null)]]></message>
<message priority="info"><![CDATA[7500 [main] INFO
com.workbrain.util.DataLoader - Modified 36 rows in TIME_CODE
table.]]></message>
<message priority="info"><![CDATA[Modified 36 rows in TIME_CODE
table.]]></message>
<message priority="info"><![CDATA[Importing file:
C:\cruisecontrol-projects\checkout\1-DEVL\Java\..\ApplicationData\QA\StandardData\3-SHIFT_BREAK.xml]]></message>
<message priority="info"><![CDATA[7610 [main] INFO
com.workbrain.util.DataLoader - Modified 30 rows in SHIFT_BREAK
table.]]></message>
<message priority="info"><![CDATA[Modified 30 rows in SHIFT_BREAK
table.]]></message>
<message priority="info"><![CDATA[Importing file:
C:\cruisecontrol-projects\checkout\1-DEVL\Java\..\ApplicationData\QA\StandardData\3-SHIFT_PATTERN.xml]]></message>
<message priority="info"><![CDATA[7688 [main] INFO
com.workbrain.util.DataLoader - Modified 34 rows in SHIFT_PATTERN
table.]]></message>
<message priority="info"><![CDATA[Modified 34 rows in SHIFT_PATTERN
table.]]></message>
<message priority="info"><![CDATA[Importing file:
C:\cruisecontrol-projects\checkout\1-DEVL\Java\..\ApplicationData\QA\StandardData\4-SHIFT_PATTERN_SHIFTS.xml]]></message>
<message priority="info"><![CDATA[8125 [main] INFO
com.workbrain.util.DataLoader - Modified 224 rows in SHIFT_PATTERN_SHIFTS
table.]]></message>
<message priority="info"><![CDATA[Modified 224 rows in SHIFT_PATTERN_SHIFTS
table.]]></message>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]