Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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: 11404
    
  81

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: awk: cmd. line:1: (FILENAME=out.txt FNR=1) fatal: division by zero attempted
 
Similar Threads
Problem in unzipping a folder using java.util.zip API
using sed to chnage data in file
Dumping MySql database
Runtime.exec problems
need help with IO