HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- large number displayed as exponential form
Operating System - HP-UX
1837004
Members
1829
Online
110111
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2003 06:49 PM
07-13-2003 06:49 PM
Hi,
I'm trying to count the number of lines in a very huge log file about 1.5 million lines in our HP-UX server which has a about 1.5GB ram. I'm using an awk script below:
#awk 'END {print MR}' logfile. The output is the following 1.50363e+06.
How can I set it so that it would not be outputted as such since I need the exact count.
I've done the same script in a linux desktop and it gives me the exact number which is 1,503,629. However, my linux box has a low memory (256 MB) so I cant keep on using it on logfiles with more than 500MB in size as it will take a very long time.
I'm trying to count the number of lines in a very huge log file about 1.5 million lines in our HP-UX server which has a about 1.5GB ram. I'm using an awk script below:
#awk 'END {print MR}' logfile. The output is the following 1.50363e+06.
How can I set it so that it would not be outputted as such since I need the exact count.
I've done the same script in a linux desktop and it gives me the exact number which is 1,503,629. However, my linux box has a low memory (256 MB) so I cant keep on using it on logfiles with more than 500MB in size as it will take a very long time.
Solved! Go to Solution.
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2003 06:58 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2003 07:22 AM
07-14-2003 07:22 AM
Re: large number displayed as exponential form
You can also change the format for a plain print statement. The OFMT variable is used by default-
awk 'END {OFMT="*.22g";print NR}' logfile
Of course, you can get the answer much faster using a more specialized command.
% time awk 'END {OFMT="%.22g";print NR}' logfile
1382156
real 0m8.51s
user 0m8.40s
sys 0m0.11s
% time (wc -l logfile | awk '{print $1}')
1382156
real 0m0.73s
user 0m0.42s
sys 0m0.32s
awk 'END {OFMT="*.22g";print NR}' logfile
Of course, you can get the answer much faster using a more specialized command.
% time awk 'END {OFMT="%.22g";print NR}' logfile
1382156
real 0m8.51s
user 0m8.40s
sys 0m0.11s
% time (wc -l logfile | awk '{print $1}')
1382156
real 0m0.73s
user 0m0.42s
sys 0m0.32s
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP