Home » Infrastructure » Unix » to get the string between 2 patterns (unix-hp, k shell)
to get the string between 2 patterns [message #445838] Thu, 04 March 2010 05:43 Go to next message
devi_vi
Messages: 10
Registered: March 2010
Location: bangalore
Junior Member

hi all.,

i need to get the string, which is in between 2 specified patterns...

for e.g, i have a variable, Tag=<ABC_FILE> ., i need the value ABC in some other variable without using temp files...

the value of tag may change everytime.... ie., it may be, <ABCD_FILE> or <FREDDAV_FILE>... i need the values in between "<" and "_" .,

pls help me someone as soon as possible.... pls....
Re: to get the string between 2 patterns [message #445850 is a reply to message #445838] Thu, 04 March 2010 06:27 Go to previous message
Michel Cadot
Messages: 58954
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
> echo $T
<ABC_FILE>
> echo $T | sed -e 's/^<\([^_]*\)_.*$/\1/'
ABC

Note that this is an ORACLE forum not a shell one.

Regards
Michel
Previous Topic: Oracle verison 10g Client for Solaris 32 bit
Next Topic: Which Linux/UNIX/Solaris/Whatever distribution is the most appropriate
Goto Forum:
  


Current Time: Mon Sep 01 14:21:52 CDT 2014

Total time taken to generate the page: 0.07688 seconds