Sponsored Content
Operating Systems Linux Red Hat Grep between two strings in shell Post 302829075 by itsspy on Thursday 4th of July 2013 03:16:24 AM
Old 07-04-2013
RedHat Grep between two strings in shell

Code:
<cisco:subname>
         <cisco:sptp>Cisco PortA Series</cisco:sptp>
         <cisco:aliasNameList xsi:nil="true"/>
         <cisco: owner xsi:nil="true"/>
                      <cisco:subportname>
                 <cisco:cpt>Cisco SubPort B Series</cisco:cpt>
                 <cisco:aliasNamesubList xsi:nil="true"/>
                 <cisco:userLabel xsi:nil="true"/>
               </cisco:subportname>
       </cisco:subname>


in the above xml file how to get the data between <cisco:subportname> and </cisco:subportname>
Moderator's Comments:
Mod Comment Please use CODE tags when showing sample input, output, and code.

Last edited by Don Cragun; 07-04-2013 at 04:34 AM.. Reason: Add CODE and ICODE tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to concatenate two strings or several strings into one string in B-shell?

like connect "summer" and "winter" to "summerwinter"? Can anybody help me? thanks a lot. (2 Replies)
Discussion started by: fontana
2 Replies

2. Shell Programming and Scripting

want to grep only strings in a file?

Hai, Just want to print only alphanumeric in a file ex:- fdsdsklf#@^%$#hf output:- fdsdsklfhf plz, help me:o (5 Replies)
Discussion started by: balan_mca
5 Replies

3. Shell Programming and Scripting

Grep Multiple Strings

Hi, Can any one pelase tell me how to grep multiple strings from multiple files in a singel folder? grep -E "string1|string2|string3|string4|string..." its taking lots of time.. can any please tell me fast grep??? URGENT (10 Replies)
Discussion started by: durgaprasad
10 Replies

4. Shell Programming and Scripting

grep two strings in a file..

Hello All, I have a big file about 1000 lines. Now i am trying to grep a particular string and printing the lines from the string. say for example in 500th line i have the date as "Mon Wed 14 20:15:24 2010". now i in my case i need to grep the combination of the strings "Mon Wed 14" and the... (7 Replies)
Discussion started by: intiraju
7 Replies

5. Shell Programming and Scripting

Can't grep multiple strings

I have a script that periodically checks the Apache error_log to search for a specific error that causes it to hand and, if found, it restarts the service. I recently found another error that forces it to hand and won't serve pages until it is reset. What I'm trying to do is to get the script to... (3 Replies)
Discussion started by: cfjohnsn
3 Replies

6. Shell Programming and Scripting

Grep 2 same strings in a same line??

I have this code TrackingId:1362412470675;MSISDN:; INFO - number of clietns:3:Received response is: EMSResponse , protocolVersion=5, purchaseOptions=null, serviceData=ServiceData , screenData=CanvasData ]], title=null, titleResource=MessageResource], screenType=null]], serviceId=idBamboo,... (7 Replies)
Discussion started by: nikhil jain
7 Replies

7. Shell Programming and Scripting

GREP between last occurrences of two strings

Hi I have the server.log file as: Server Stopped ABC DEF GHI JKL Server Started MNO PQR STU Server Stopped VWX YZ ABC Server Started Server Stopped 123 456 789 (9 Replies)
Discussion started by: ankur328
9 Replies

8. Shell Programming and Scripting

Grep for strings

Hi, Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.94 Safari/537.36 How can I grep for the strings chrome and safari from a file, and if chrome print Chrome/40.0.2214.94 to a file and also count the number of times chrome is found? ... (4 Replies)
Discussion started by: cyberfrog
4 Replies

9. Shell Programming and Scripting

Grep strings for different cases

Hi All, Good morning I have a below code which is working & getting expected output. the problem in this code is it is executing 3 if conditions, my requirement is suppose if first condition is success then it should print echo statement & exit from if condition else if the 1st if condition... (4 Replies)
Discussion started by: sam@sam
4 Replies

10. Programming

Python or Shell script to Grep strings from input file and output in csv format

Hi Experts, I am writing a python script to grep string from file and display output in csv file as in attached screenshot https://drive.google.com/file/d/1gfUUdfmQma33tz65NskThYDhkZUGQO0H/view Input file(result_EPFT_config_device) Below is the python script i have prepared as of... (1 Reply)
Discussion started by: as7951
1 Replies
machid(1)						      General Commands Manual							 machid(1)

NAME
machid: hp9000s200, hp9000s300, hp9000s400, hp9000s500, hp9000s700, hp9000s800, hp-mc680x0, hp-pa, pdp11, u370, u3b, u3b10, u3b2, u3b5, vax - provide truth value about processor type SYNOPSIS
DESCRIPTION
The following commands return a true value (exit code 0) if the a processor type matches the command name. Otherwise a false value (exit code nonzero) is returned. These commands are commonly used within makefiles and shell procedures to improve portability of applications (see make(1)). +-----------+-------------------------++--------+--------------------------+ |Command | True for ||Command | True for | +-----------+-------------------------++--------+--------------------------+ |hp9000s200 | Series 200 ||pdp11 | PDP-11/45 or PDP-11/70 | |hp9000s300 | Series 300 ||u3b | 3B20 computer | |hp9000s400 | Series 400 ||u3b2 | 3B2 computer | |hp9000s500 | Series 500 ||u3b5 | 3B5 computer | |hp9000s700 | Series 700 ||u3b10 | 3B10 computer | |hp9000s800 | Series 800 or 700 ||u370 | IBM System/370 computer | |hp-mc680x0 | Series 200, 300, or 400 ||vax | VAX-11/750 or VAX-11/780 | |hp-pa | Series 700 or 800 || | | +-----------+-------------------------++--------+--------------------------+ EXAMPLES
Given a shell script that must behave differently when run on an HP 9000 Series 700 or 800 system, select the correct code segment to be executed: WARNINGS
always returns true on both Series 800 and Series 700 systems. Therefore, when using this command in scripts to determine hardware type, always use both and in the appropriate sequence to ensure correct results (see machid(1) will no longer provide support for future machines beyond the Series 800 and Series 700 systems. Decisions should be based on the hardware and software configuration information returned by getconf(1). SEE ALSO
getconf(1), make(1), sh(1), test(1), true(1). machid(1)
All times are GMT -4. The time now is 01:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy