korn shell script question

From: Brehl, Blake (Blake.Brehl_at_anritsu.com)
Date: 10/24/03

  • Next message: Iain Barker: "SUMMARY: Remote firmware update via LFU ?"
    Date: Thu, 23 Oct 2003 16:00:21 -0700
    To: "Tru64 Mailing List (tru64-unix-managers@ornl.gov)" <tru64-unix-managers@ornl.gov>
    
    

    Hi,

    I want to identify the number of the line of the last occurance of the
    string "End of Report" within a file.

    #> more somefile
    line1
    line2
    End of Report
    line4
    End of Report
    line6
    End of Report
    #>

    #> #!/bin/ksh
    #> grep -in "End of Report" somefile | awk -F: '{print $1}'

    results in

    3 5 7

    Is there a way to capture the last value (7), when you don't know how many
    occurance? I have gnugrep loaded if that is a better command.
      
    TRU64UNIX V5.1A sp4

    Best Regards,

    Blake Brehl
    Sys Admin/DBA
    Anritsu Company United States
    Morgan Hill, CA


  • Next message: Iain Barker: "SUMMARY: Remote firmware update via LFU ?"

    Relevant Pages

    • Re: Please Help! Ref Article ID 210504
      ... > each occurance to the "In Time" of the next occurance. ... >> You are correct that you would not be able to use the DLookup method ... >> solution is to do the math in a query. ... >>> I simply need to set up a report which will show me the the elapsed ...
      (microsoft.public.access.gettingstarted)
    • SUMMARY: korn shell script question
      ... How about doing the whole thing in awk, ... Each time it finds the line with the regular expression within slashes, ... I want to identify the number of the line of the last occurance of the ... string "End of Report" within a file. ...
      (Tru64-UNIX-Managers)
    • Re: Bird flu crosses to Pigs
      ... The occurance in China was only reported in August of the same year - the ... report described evidence from 2002 and 2003 ... So this is old news -- 2 and a half years old - including on ...
      (uk.business.agriculture)
    • vba: How do I write a "For Each Statement" nested in a "With Statement"?
      ... Im trying to print a customer record in a report for each occurance of ... string to a date (dtReportDate) and if the date is found, ... containing that date will create a new record in my report. ... If Not rng Is Nothing Then ...
      (microsoft.public.excel.programming)