Sponsored Content
Top Forums Shell Programming and Scripting need to get the total # of column for each line - NF not working Post 302482897 by Ygor on Wednesday 22nd of December 2010 10:32:53 PM
Old 12-22-2010
Try something like...
Code:
$ printf "a\tb\tc\n" | awk -v var="009" 'BEGIN{FS=sprintf("%c", var)} {print NF}'
3

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sum total by column

Hi, i have a file which content the following: >cat cols data a:23:data data b:76:data data c:-30:data i would like to sum up the value of column 2, but the result that return to me is 0. Can anyone help? i'm using this code to do the sum awk -F" " 'BEGIN {x=0} {x+=$2} END {print... (5 Replies)
Discussion started by: thh
5 Replies

2. Shell Programming and Scripting

Finding the total of a column using awk

Here is my file name countries USSR 8650 262 Asia Canada 3852 24 North America China 3692 866 Asia USA 3615 219 North America Brazil 3286 116 South America India 1269 637 Asia Argentina 1072 ... (8 Replies)
Discussion started by: ironhead3fan
8 Replies

3. Shell Programming and Scripting

Help with total up based on same column info

Input file data US 100.25 data ENG 235.01 data US 23.12 data ENG 23.01 END UK 230.50 END Russia 20.00 . . Desired output data US 123.37 data ENG 258.02 END UK 230.50 END Russia 20.00 . . (1 Reply)
Discussion started by: perl_beginner
1 Replies

4. Shell Programming and Scripting

Help with total up all column info

Input file 11916 30640 9320 51876 5690 15874 4723 26287 5121 12269 2569 19959 9 71 6 86 Desired output file 11916 30640 9320 51876 5690 15874 4723 26287 5121 12269 2569 19959 9 71 6 86 22736 58854 16618 98208 Last part is the total up of first three data. I used the following... (6 Replies)
Discussion started by: perl_beginner
6 Replies

5. Shell Programming and Scripting

1st column,2nd column on first line 3rd,4th on second line ect...

I need to take one column of data and put it into the following format: 1st line,2nd line 3rd line,4th line 5th line,6th line ... Thanks! (6 Replies)
Discussion started by: batcho
6 Replies

6. Shell Programming and Scripting

Total of 5th column using awk or any other utility in UNIX??

Hi I have this file which contains Al,AADESH,id1_0,23,2013-01-28,2,2 Al,AADESH,id1_0,23,2013-01-29,4,4 Al,AADESH,id1_0,23,2013-01-30,2,1 Al,AADESH,id1_0,31,2013-01-29,1,1 Al,AESH,id1_0,31,2013-01-31,2,2 Al,AESH,id2_2,23,2013-01-29,1,1 Al,AESH,id2_2,31,2013-01-31,1,1 ... (5 Replies)
Discussion started by: nikhil jain
5 Replies

7. Shell Programming and Scripting

Total of a column from a file

Hi i need to calculate the total of a column from a file in ksh vi file.txt System : CBSE ent=0.1 me=Cap Subject Maths Science xxxxx 56 98 yyyy 89 67 ooo 67 32 Here i need to calculate only the total of Maths column alone i.e., 56+89+67 ... (4 Replies)
Discussion started by: Priresh
4 Replies

8. Shell Programming and Scripting

Column total

Input `0B0A RDF1+TDEV 45 BL_lmapm03 `0CE7 TDEV 59 BL_lmapm03 `0B09 RDF1+TDEV 70 BL_lmapm02 `0CE6 TDEV 59 BL_lmapm02 `0B08 RDF1+TDEV 70 BL_lmapm01 `0CE5 TDEV 59 BL_lmapm01 Output... (2 Replies)
Discussion started by: greycells
2 Replies

9. Shell Programming and Scripting

Help with calculate the total sum of record in column one

Input file: 101M 10M10D20M1I70M 10M10D39M4I48M 10M10D91M 10M10I13M2I7M1I58M 10M10I15M1D66M Output file: 101M 101 0 0 10M10D20M1I70M 100 1 10 10M10D39M4I48M 97 4 10 10M10D91M 101 0 10 10M10I13M2I7M1I58M 88 13 0 10M10I15M1D66M 91 10 1 I'm interested to count how many total of... (6 Replies)
Discussion started by: perl_beginner
6 Replies
snnewgroup.v0.3.8(8)					      System Manager's Manual					      snnewgroup.v0.3.8(8)

NAME
snnewgroup - create a new sn newsgroup SYNOPSIS
snnewgroup newsgroup [server] [port] DESCRIPTION
snnewgroup creates newsgroup assigning it an upstream NNTP server of server:port. If port is not specified, defaults to 119. If server is also not specified, newsgroup is created as a local group which is fed only by articles POSTed to it. You will need to be root or own /var/spool/sn in order to add new groups. ENVIRONMENT VARIABLES
SNROOT If this is set and is not empty, the value is used in place of /var/spool/sn, the default news spool directory. FILES CREATED
/var/spool/sn/newsgroup Directory where articles will be stored. /var/spool/sn/newsgroup/.created Empty file for the newsgroup creation time. /var/spool/sn/newsgroup/.serial Where snget gets its idea of the new starting serial number for newsgroup on server server:port. The value is initialized to 0. /var/spool/sn/newsgroup/.outgoing If server is specified, is a symlink to /var/spool/sn/.outgoing/server:port, which is a directory, created if it does not already exist. If server is not specified, no file /var/spool/sn/newsgroup/.outgoing will be created. See also snsend. SEE ALSO
sndelgroup, snsend N.B. Harold Tay snnewgroup.v0.3.8(8)
All times are GMT -4. The time now is 03:37 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy