![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to Extract | Harikrishna | SUN Solaris | 3 | 06-20-2008 04:43 AM |
| extract using sed/awk - need help? Please!! | gzs553 | Shell Programming and Scripting | 5 | 10-08-2007 05:54 PM |
| How to extract the PID from 'ps -ef' | nsinha | Shell Programming and Scripting | 7 | 11-20-2006 07:47 AM |
| tar. I can't extract | volleyboy | UNIX for Dummies Questions & Answers | 1 | 02-17-2006 11:54 AM |
| extract from TAR | big123456 | UNIX for Advanced & Expert Users | 8 | 07-28-2005 04:00 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Ok, new problem, ive got the following text file: Code:
<JDBCDataSource JNDIName="jdbc/rDB"
Name="" PoolName="Othername" Targets="myserver"/>
<JDBCConnectionPool CapacityIncrement="2"
DriverName="net.sourceforge.jtds.jdbc.Driver"
InitialCapacity="4" MaxCapacity="20" Name="Othername"
PasswordEncrypted="" Properties="user="
Targets="myserver" TestConnectionsOnRelease="false" URL=""/>
<JDBCDataSource JNDIName="jdbc/FirstDataBankDB" Name="fdbDataSource"
PoolName="Othernamel" Targets="myserver"/>
<JDBCConnectionPool CapacityIncrement="5"
DriverName="oracle.jdbc.driver.OracleDriver" InitialCapacity="5"
MaxCapacity="35" Name="Othername"
PasswordEncrypted=""
PreparedStatementCacheSize="25"
Properties=;dll=ocijdbc8;protocol=thin"
RefreshMinutes="10" Targets="myserver"
TestConnectionsOnRelease="false" TestConnectionsOnReserve="true"
TestTableName="dual" URL=""/>
<JDBCDataSource JNDIName=""
Name="ThisName"
PoolName="l" RowPrefetchEnabled="true"
RowPrefetchSize="100" Targets="myserver"
CapacityIncrement="2"
DriverName="net.sourceforge.jtds.jdbc.Driver"
InitialCapacity="4" MaxCapacity="20" Name=""
PasswordEncrypted="" Properties="user"
Targets="myserver" TestConnectionsOnRelease="false" URL=""/>
<JDBCDataSource JNDIName="jdbc/rDB"
Name="" PoolName="Othername" Targets="myserver"/>
<JDBCConnectionPool CapacityIncrement="2"
DriverName="net.sourceforge.jtds.jdbc.Driver"
InitialCapacity="4" MaxCapacity="20" Name="Othername"
PasswordEncrypted="" Properties="user="
Targets="myserver" TestConnectionsOnRelease="false" URL=""/>
<JDBCDataSource JNDIName="jdbc/FirstDataBankDB" Name="fdbDataSource"
PoolName="Othernamel" Targets="myserver"/>
</Domain>
I need a SED function that isolates everything form "<JDBCDataSource" to "/>" where the Name parameter is "Name=ThisName". Ive tried modifying the range function given above, but I don't know how to make SED ignore the newline characters within a regular expression. The order of the entries is not guaranteed to be as listed and there can be many <JDBCDataSource entries. ---------- Post updated at 01:54 PM ---------- Previous update was at 01:24 PM ---------- I just thought of something. If I can get all of the entries on their own single line I could just grep for the "ThisName" parameter. Can anyone come up with a SED function that places everything in between "<" and "/>" on its own single line? ---------- Post updated at 02:57 PM ---------- Previous update was at 01:54 PM ---------- Or extract everything between the first occurrence of "<JDBCDataSource" before "Name=ThisName" and the first occurrence of "/>" after "Name=ThisName". Last edited by ArterialTool; 08-26-2009 at 02:38 PM.. |
|
||||
|
Quote:
Code:
awk '/ThisName/' ORS="\n\n" RS= FS="\n" file Regards |
![]() |
| Bookmarks |
| Tags |
| faq, xml parsing |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|