The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 10-09-2008
palsevlohit_123 palsevlohit_123 is offline
Registered User
  
 

Join Date: Aug 2008
Location: India-Chennai
Posts: 120
help to get the block from a file

Code:
<Connection^M
                        companyId="TCS"^M
                        connectionMode="client"^M
                        name="TCS_TEMP"^M
                        protocolVersion="4.2"^M
                        disableLogging="false"^M
</Connection>

<Connection^M
                        companyId="HCL"^M
                        connectionMode="client"^M
                        name="HCL_RSDC02"^M
                        protocolVersion="4.2"^M
                        disableLogging="false"^M
</Connection>

<Connection^M
                        companyId="SCB"^M
                        connectionMode="server"^M
                        name="SCB_ERSDC02"^M
                        protocolVersion="4.1"^M
                        disableLogging="false"^M
                        connectionIntervals="08:00:00,18:00:00"^M
                        connectAtStartup="true"^M

</Connection>
<Connection^M
                        companyId="SAT"^M
                        connectionMode="client"^M
                        name="SAT_RSDC02"^M
                        protocolVersion="4.0"^M
                        disableLogging="false"^M
</Connection>
I have the above content in one file. if i grep for name="SCB_ERSDC02" it should display the corresponding block from <Connection^M until </Connection>.
Any commands...?

Code:
output should be
 
<Connection^M
                        companyId="SCB"^M
                        connectionMode="server"^M
                        name="SCB_ERSDC02"^M
                        protocolVersion="4.1"^M
                        disableLogging="false"^M
                        connectionIntervals="08:00:00,18:00:00"^M
                        connectAtStartup="true"^M

</Connection>