Sponsored Content
Full Discussion: Adding Column Of Numbers
Top Forums UNIX for Dummies Questions & Answers Adding Column Of Numbers Post 302777353 by Yoda on Thursday 7th of March 2013 05:26:28 PM
Old 03-07-2013
Code:
awk ' { a[$1" "$2] += $3 } END { for ( i in a) print i, a[i] } ' file

This User Gave Thanks to Yoda For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Adding 2 numbers

I would like to write a script with BASH to add two numbers (integer) and write the result to the standard output. Please help! (7 Replies)
Discussion started by: Viper01
7 Replies

2. Shell Programming and Scripting

adding float numbers

how to add 2 float values to each other? i tried this and it doesnt work: #!bin/bash numone=1.234 numtwo=0.124 total=`expr $numone + $numtwo` echo $total thanks (5 Replies)
Discussion started by: strike
5 Replies

3. UNIX for Advanced & Expert Users

Adding a column of numbers

Hello, I have a file, and one column has both positive and negative numbers. Does anyone know how I can calculate the total of all the values (i.e, +ve and -ve). eg: col1 col2 col3 data 23 data data 76 data data -30 data Thanks Khoom (1 Reply)
Discussion started by: Khoomfire
1 Replies

4. UNIX for Dummies Questions & Answers

Adding numbers in unix

Hi this is quite a simple question... I am new to LINUX/UNIX and so I am just trying to create a very basic program. The idea is that when the user runs the program (from the shell) they enter 3 values and the program will add them up: "./sum 23 5 1 29" my code for this program is as follows: ... (4 Replies)
Discussion started by: csuieb
4 Replies

5. Shell Programming and Scripting

Rename a header column by adding another column entry to the header column name URGENT!!

Hi All, I have a file example.csv which looks like this GrpID,TargetID,Signal,Avg_Num CSCH74_1_1,2007,61,256 CSCH74_1_1,212007,647,679 CSCH74_1_1,12007,3,32 CSCH74_1_1,207,299,777 I want the output as GrpID,TragetID,Signal-CSCH74_1_1,Avg_Num CSCH74_1_1,2007,61,256... (4 Replies)
Discussion started by: Vavad
4 Replies

6. Shell Programming and Scripting

Adding numbers

Hi I figured how to add my list of numbers. However how do I count so that after a certain number it lists the line. Example: 12 test1 46 test2 195 test3 174 test4 634 test5 185 test6 94 test7 So basically add the numbers and when the addition reaches 300 or less print the... (8 Replies)
Discussion started by: bombcan
8 Replies

7. Shell Programming and Scripting

Adding numbers in a string

I am writing a bash script on ubuntu11.10 I have some string having numbers and letter and want to add all the numbers together For example 1s2d23f I want to perform 1 + 2 + 23 and store it in a variable (3 Replies)
Discussion started by: kristinu
3 Replies

8. Shell Programming and Scripting

help with adding up numbers

I have a file which has following contents which I want to add up. 28170.24 28170.24 28170.24 28170.24 28170.24 28170.24 28170.24 28170.24 28170.24 28170.24 28170.24 28170.24 28170.24 28170.24 139038.72 139038.72 139038.72 139038.72 (5 Replies)
Discussion started by: aksijain
5 Replies

9. UNIX for Dummies Questions & Answers

Adding a column to a text file with row numbers

Hi, I would like to add a new column containing the row numbers to a text file. How do I go about doing that? Thanks! Example input: A X B Y C D Output: A X 1 B Y 2 C D 3 (5 Replies)
Discussion started by: evelibertine
5 Replies

10. Shell Programming and Scripting

Adding (as in arithmetic) to numbers in columns in file, and writing new file with new numbers

Hi again. Sorry for all the questions — I've tried to do all this myself but I'm just not good enough yet, and the help I've received so far from bartus11 has been absolutely invaluable. Hopefully this will be the last bit of file manipulation I need to do. I have a file which is formatted as... (4 Replies)
Discussion started by: crunchgargoyle
4 Replies
telecode(5)							File Formats Manual						       telecode(5)

NAME
telecode - A character encoding system (codeset) for Traditional Chinese DESCRIPTION
The Telecode codeset (called Mitac Telex in early versions of the operating system) consists of 2 character planes. Each character plane has 8836 character positions. In plane 1, standard characters occupy positions 0001 to 8045; the remaining 791 positions are for user- defined characters. In plane 2, standard characters occupy positions 0001 to 8489; the remaining 346 positions are for user-defined charac- ters. Telecode uses 2-byte values to represent characters on both planes. Plane 1 Character Encoding To differentiate plane 1 code from plane 2 code, the most significant bit (MSB) is set on in both bytes of a plane 1 character code. The following formula calculates the value of a plane 1 character from its position on the plane: 1st byte = M + 161 2nd byte = N + 161 - M x 94 In this formula, N is the position of the character and M = N / 94. For example, if a character is at position 2502 on plane 1, its encoding value is BBDB, which is calculated as follows: N = 2502, M = 2502/94 = 26 1st byte = 26 + 161 = 187 2nd byte = 2502 + 161 - 26 x 94 = 219 Plane 2 Character Encoding To differentiate plane 2 code from plane 1 code, the MSB of the first byte is set on and that of the second byte is set off for each plane 2 character code. The following formula calculates the value of a plane 2 character from its position: 1st byte = M + 161 2nd byte = N + 33 - M x 94 In this formula, N is the position of the character on the plane and M = N / 94. For example, if a character is at position 2502 on plane 2, its encoding value is BB5B, which is calculated as follows: N = 2502, M = 2502/94 = 26 1st byte = 26 + 161 = 187 2nd byte = 2502 + 33 - 26 x 94 = 91 Codeset Conversion The following codeset converter pairs are available for converting Traditional Chinese characters between telecode and other encoding for- mats. Refer to iconv_intro(5) for an introduction to codeset conversion. For more information about the other codeset for which telecode is the input or output, see the reference page specified in the list item. big5_telecode, telecode_big5 Converting from and to the Big-5 codeset: big5(5). Note that Big-5 encoding is equivalent to the Microsoft code-page format used on PCs for Traditional Chinese. You can therefore use these converters to convert Traditional Chinese characters between PC code page format and Telecode encoding format. For more infor- mation on how the operating system supports PC code pages, see code_page(5). dechanyu_telecode, telecode_dechanyu Converting from and to the DEC Hanyu codeset: dechanyu(5). eucTW_telecode, telecode_eucTW Converting from and to Taiwanese Extended UNIX Code: eucTW(5). Font Support for Telecode The operating system supports Telecode only through conversion to another codeset. SEE ALSO
Commands: locale(1) Others: ascii(5), big5(5), Chinese(5), code_page(5), dechanyu(5), dechanzi(5), eucTW(5), GBK(5), i18n_intro(5), i18n_printing(5), iconv_intro(5), l10n_intro(5), sbig5(5) telecode(5)
All times are GMT -4. The time now is 11:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy