tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
From: "Brehl, Blake" <Blake.Brehl@anritsu.com>
Subject: korn shell script question
Date: Thu, 23 Oct 2003 16:00:21 -0700	[thread overview]
Message-ID: <B6AB323D7140944E9AD51206F7078F6705571B46@moh-exc-002.main.intgin.net> (raw)

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


             reply	other threads:[~2003-10-23 23:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-23 23:00 Brehl, Blake [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-08-24 15:21 Korn Shell Script question Jonathan Williams
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox