korn shell script question

From: Brehl, Blake <Blake.Brehl_at_anritsu.com>
Date: Thu, 23 Oct 2003 16:00:21 -0700

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
Received on Thu Oct 23 2003 - 23:02:40 NZDT

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:44 NZDT