aspose file tools*
The moose likes Linux / UNIX and the fly likes awk: cmd. line:1: (FILENAME=out.txt FNR=1) fatal: division by zero attempted Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "awk: cmd. line:1: (FILENAME=out.txt FNR=1) fatal: division by zero attempted" Watch "awk: cmd. line:1: (FILENAME=out.txt FNR=1) fatal: division by zero attempted" New topic
Author

awk: cmd. line:1: (FILENAME=out.txt FNR=1) fatal: division by zero attempted

Saravanan Mrajan
Greenhorn

Joined: Jun 28, 2009
Posts: 18
awk '$1 != "" {print Action $1 lastuser}' out.txt

where Action = getting the attribute of the files in the $1 fields.

out.txt file contins the below:
test1.html
Testpage.html

But while executing this i am getting the error as

awk: cmd. line:1: (FILENAME=out.txt FNR=1) fatal: division by zero attempted


Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11481
    
  94

What's your definition for the Action function? Without that it is not really possible to think of what the problem might be. My guess is that Action has the ability to calculate file sizes in human terms (converting to Kb, Mb etc) and is not handling zero sized files correctly.


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
 
wood burning stoves
 
subject: awk: cmd. line:1: (FILENAME=out.txt FNR=1) fatal: division by zero attempted