The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 10-04-2006
sjf sjf is offline
Registered User
  
 

Join Date: Oct 2006
Posts: 3
Check last line with gawk?

I am writing a gawk script that checks some basic code conformance rules (java text files) using gawk. So far, so good.

But I have a requirement to ensure that the last line in the java source files is "/* eof */". The below snippet works BUT is called more than once per file as / / matches a "few" too many expressions. So how do I perform this check only once???
...
/ /{
if ( tail -1 FILENAME ~ "/* eof */" ) {
print "Yeah"
}
}
...

Go easy, I'm a newbie.