If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > searching for text

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-27-04, 00:10
sachin_mt sachin_mt is offline
Registered User
 
Join Date: Jan 2003
Posts: 106
searching for text

I need to search for a text in a file
the file will contain text as follows

------------------------------------------------
sdasdgdgfdsf
dfghsdf
dhffd
dfdfdfdf

[applications]
/abc="/sas/asa/saas"
/def="/sdsd/sdsds/dsds/sdsd"

sdsd
----------------------------------------------
In this file
I need to search for a string in variable $a

i should be able to search only those lines which comes after the line[applications] and before the line sdsd.assume these two lines never change but the content in between keep changing but in the same pattern as shown.

if $a value matches with a string which starts with / and ends with =,ex abc
which comes between / and = or def or any other lines which appear below it, it should say string exists else string does not exist
__________________
Sachi
Reply With Quote
  #2 (permalink)  
Old 04-29-04, 07:01
rkrishnan73 rkrishnan73 is offline
Registered User
 
Join Date: Mar 2004
Posts: 10
This is only an outline logic.

- Number all the lines in the file
- Find the line number of the header and the corresponding footer
- Read only those lines between these two lines

Tip: May use cat -n, head, tail
Reply With Quote
  #3 (permalink)  
Old 05-04-04, 04:22
iconv_john iconv_john is offline
Registered User
 
Join Date: May 2004
Posts: 3
Typical job for a perl script.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On