- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: i need a command for sum
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
Forums
Discussions
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
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
08-21-2002 11:51 AM
08-21-2002 11:51 AM
i need a command for sum
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2002 11:52 AM
08-21-2002 11:52 AM
Re: i need a command for sum
# man expr
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2002 12:15 PM
08-21-2002 12:15 PM
Re: i need a command for sum
in the file there are the nex
salida.txt
34k
24k
76k
89m
50k
78kb
and i need sum all the numbers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2002 12:16 PM
08-21-2002 12:16 PM
Re: i need a command for sum
awk '{s=s+$1}END{print s}' yourfile
This will sum the first field in "yourfile" and print the result.
Hope this helps.
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2002 12:21 PM
08-21-2002 12:21 PM
Re: i need a command for sum
awk '{sub("k","000");sub("m","000000");s=s+$1}END{printf "%15d\n",s}' yourfile
Hope this helps more...
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2002 04:00 PM
08-21-2002 04:00 PM
Re: i need a command for sum
it's correct
it's all ok...
see you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2002 05:02 PM
08-21-2002 05:02 PM
Re: i need a command for sum
How's this??
echo 0 `cat textfile | sed -e "s/ //g" -e "s/RSS/0/" -e "s/M/000K/" -e "s/K/000/" -e "s/^/+ /"` | bc
live free or die
harry