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
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: 68415
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
> echo $T
> echo $T | sed -e 's/^<\([^_]*\)_.*$/\1/'

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

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: Wed Mar 22 01:17:38 CDT 2023