Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2003
    Posts
    106

    Unanswered: 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

  2. #2
    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

  3. #3
    Join Date
    May 2004
    Posts
    3
    Typical job for a perl script.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •