- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: awk script
Categories
Company
Local Language
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
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
Community
Resources
Forums
Blogs
- 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
05-22-2002 07:37 PM
05-22-2002 07:37 PM
awk script
This is my script
ls -l *.t | awk '{ print x +=$5 }'
it should add all the bytes for *.t files.
but i am getting 2.11362e+08. how to get
correct bytes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2002 07:42 PM
05-22-2002 07:42 PM
Re: awk script
The output is 200 meg
Regards
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2002 07:45 PM
05-22-2002 07:45 PM
Re: awk script
Another way of doing it would be to
ls -l
Then add the totals in the file with
cat /tmp/totals | awk 'BEGIN {total=0;} {total=total+$1;} END {print total,"\n";}'
Regards
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2002 07:48 PM
05-22-2002 07:48 PM
Re: awk script
Sorry, the correct value is 211,362,000
2^8
Regards
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2002 08:56 PM
05-22-2002 08:56 PM
Re: awk script
# ls -l *.t | awk '{ printf ("%10.2f\n",x+=$5) }'
That will give you 10 digits before the decimel point and 2 digits after the decimel point.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2002 09:07 PM
05-22-2002 09:07 PM
Re: awk script
Thanks steven and skchan. skchan script
rectified my problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2002 09:10 PM
05-22-2002 09:10 PM
Re: awk script
I see you are a new forum user
You can assign points by clicking on the 'assign points' tab next to replies
Regards
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2002 09:51 PM
05-22-2002 09:51 PM
Re: awk script
Naga
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2002 09:53 PM
05-22-2002 09:53 PM
Re: awk script
Naga
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2002 04:15 AM
05-23-2002 04:15 AM
Re: awk script
or reformatted to your liking
perl -le '$s+=-s for<*.t>;printf"%8.2f",$s'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2002 11:16 AM
05-23-2002 11:16 AM
Re: awk script
Problem: printing num E
This is the behavior of the print statement in awk.
Solution: use printf
printf() syntax is exactly like in C programming.
Regards,
Shannon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2002 12:35 AM
05-24-2002 12:35 AM
Re: awk script
unfortunately awk uses internally a floating point arithmetic. That is less accurate than using integer arithmitic with same variable size, because some of the bytes are used for the exponent.
Regards, Klaus