korn shell script question

From: Brehl, Blake (Blake.Brehl@anritsu.com)
Date: Thu Oct 23 2003 - 19:00:21 EDT


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



This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 10:49:39 EDT