The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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 string? namrata5 High Level Programming 2 10-24-2007 04:17 AM
Extract digits at end of string offirc Shell Programming and Scripting 6 11-20-2006 11:57 AM
Extract String sehgalniraj UNIX for Dummies Questions & Answers 1 09-25-2006 01:35 PM
Extract String bestbuyernc Shell Programming and Scripting 5 11-14-2005 03:42 PM
How to extract a portion of a string from the whole string ds_sastry UNIX for Dummies Questions & Answers 2 09-29-2001 11:40 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 11-20-2007
rakeshou rakeshou is offline
Registered User
  
 

Join Date: May 2007
Posts: 75
Wink Extract string between <>

hi,

I want a simple way to extract string between two angle brackets <>

the text looks like

echo "###Usage: $0 <database1> <database2>"

what I want is two variables DB1=database1 and DB2=database2

What I am doing looks clumsy to me


Code:
DB1=`echo $line | sed 's/"//g' | sed 's/>//g' | awk -F"<" '{print $2}'`
DB2=`echo $line | sed 's/"//g' | sed 's/>//g' | awk -F"<" '{print $3}'`

thanks in advance
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:03 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0