The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 04-12-2008
melias melias is offline
Registered User
 

Join Date: Oct 2007
Posts: 13
sed - searching for string and storing in variable

Hi

I'm trying to find a way to search a text file for a specific string.

I have a file which contains i.p. addresses and port numbers in the following format:

'ip="www.xxx.yyy.zzz"'
'port="xx""'

I want to print only the parts between the double quotes for use in seperate variables, if this makes sense. I do not want to store the i.p=" " or port=" " parts of the string.

Also the i.p. and corresponding port number are on the same line, if this helps.

This is what the actual line looks like:

<LS id="group1" ip="www.xxx.yyy.zzz" port="aa" acceptorthreads="1" security="off" defaultvs="http-test-http" servername="test.test.com" >

Thanks in advance.
Reply With Quote
Forum Sponsor