02-22-2012
Hi
ctsgnb,
The command "
awk 'p!=$1{if(p)print p,s,t;s=t=x;p=$1}{s+=$2;t+=$3}END{print p,s,t}' $FILE/ban.txt > $FILE/banresult.txt" is working fine for first 6 lines and for rest of the line it shows 0.
I have 100 lines in a file, please let me know if im doing any mistake!!!
Prd c1 c2
bag 12 12
bag 18 15
bags 15 13
bags 15 14
blazer 24 24
blazer 33 32
boots 19 15
cardigan 12 11
cardigan 31 30
cardigan 32 27
chino 12 10
clearance 11 10
clearance 11 9
coat 22 20
coat 29 24
coats 15 13
cologne 18 18
cologne 19 17
dress 63 56
dress 71 59
dresses 14 12
dresses 94 86
dresses 96 80
fragrance 11 11
handbags 11 9
handbags 18 17
hats 13 9
jackets 16 14
jeans 24 21
jeans 28 21
leather%20jacket 20 20
leather%20jacket 28 27
leggings 19 19
leggings 29 26
mad%20men 104 89
mad%20men%20collection 14 14
mad%20men 21 18
mad%20men 99 89
man 11 10
maternity 15 15
maternity 21 18
men 26 24
men 28 21
men 75 67
men 88 75
mens%20shoes 13 13
monogram 11 11
order%20status 34 33
order%20status 42 36
palisades%20tote 14 13
palisades%20tote 16 13
pants 11 10
pants 12 11
perfume 12 11
perfume 47 45
perfume 53 44
petite 13 13
petite 21 18
polka%20dot 14 14
purse 12 8
purse 13 11
sale 40 39
sale 48 41
scarf 18 18
scarf 20 17
shirts 19 16
shoes 42 42
shoes 49 43
shorts 29 28
shorts 31 29
shorts 37 33
shorts 42 37
size%20chart 14 13
size%20chart 18 18
skirt 14 14
skirts 11 9
Sloan 13 11
suits 17 16
suits 18 17
sweater 24 24
sweater 30 26
sweaters 14 10
swim 12 11
swim 12 12
swim 14 14
swim 17 14
ties 12 6
tops 11 9
tote 11 11
trench%20coat 11 11
trench%20coat 17 16
trench 35 33
trench 47 41
vest 30 30
vest 33 32
vest 41 36
vest 49 41
women 11 9
women 44 37
women 57 49
And also please let me know, how to remove a double/triple space between c1 & c2 and make it single space line.
Regards
Wintech
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
I am new to this forum and new to awk.
I have a file that contains 2 columns.
Heres an example of what it looks like:
10 +
20 +
40 +
50 -
70 -
So the file is tab-delimited. What I want to do is add 10 to column 1 whenever column 2 is + and substract 10 from column 1... (1 Reply)
Discussion started by: phil_heath
1 Replies
2. Shell Programming and Scripting
Hi All,
I have a file which is having 3 columns as (string string integer)
a b 1
x y 2
p k 5
y y 4
.....
.....
Question:
I want get the unique value of column 2 in a sorted way(on column 2) and the sum of the 3rd column of the corresponding rows. e.g the above file should return the... (6 Replies)
Discussion started by: amigarus
6 Replies
3. UNIX for Dummies Questions & Answers
Hi,
I've shown an example of what I would like to achieve below. In the example file, I would like to sum the values in column 2 for each distinct category in column 3 (presumably making an array?) and print the sum as well as the category name and length (note:length always corresponds with... (8 Replies)
Discussion started by: auburn
8 Replies
4. Shell Programming and Scripting
I have a following inputfile
MT,AP,CDM,TTML,MUM,GS,SUCC,3
MT,AP,CDM,TTSL,AP,GS,FAIL,9
MT,AP,CDM,RCom,MAH,GS,SUCC,3
MT,AP,CDM,RTL,HP,GS,SUCC,1
MT,AP,CDM,Uni,UPE,GS,SUCC,2
MT,AP,CDM,Uni,MUM,GS,SUCC,2
TTSL,AP,GS,MT,MAH,CDM,SUCC,20
TTML,AP,GS,MT,MAH,CDM,FAIL,10... (2 Replies)
Discussion started by: siramitsharma
2 Replies
5. Shell Programming and Scripting
Hi,
I have a similar input format-
A_1 2
B_0 4
A_1 1
B_2 5
A_4 1
and looking to print in this output format with headers. can you suggest in awk?awk because i am doing some pattern matching from parent file to print column 1 of my input using awk already.Thanks!
letter number_of_letters... (5 Replies)
Discussion started by: prashob123
5 Replies
6. Shell Programming and Scripting
Hi,
I have a table to be imported for R as matrix or data.frame but I first need to edit it because I've got several lines with the same identifier (1st column), so I want to sum the each column (2nd -nth) of each identifier (1st column)
The input is for example, after sorted:
K00001 1 1 4 3... (8 Replies)
Discussion started by: sargotrons
8 Replies
7. UNIX for Dummies Questions & Answers
Hi All,
I have a requirement where I need to find sum of values from column D through O present in a CSV file and check whether the sum of each Individual column matches with the value present for that corresponding column present in the trailer record.
For example, let's assume for column D... (9 Replies)
Discussion started by: tpk
9 Replies
8. UNIX for Beginners Questions & Answers
I have a file which need to be summed up using date column.
I/P:
2017/01/01 a 10
2017/01/01 b 20
2017/01/01 c 40
2017/01/01 a 60
2017/01/01 b 50
2017/01/01 c 40
2017/01/01 a 20
2017/01/01 b 30
2017/01/01 c 40
2017/02/01 a 10
2017/02/01 b 20
2017/02/01 c 30
2017/02/01 a 10... (6 Replies)
Discussion started by: Booo
6 Replies
9. Shell Programming and Scripting
Hi Experts,
Please bear with me, i need help
I am learning AWk and stuck up in one issue.
First point : I want to sum up column value for column 7, 9, 11,13 and column15 if rows in column 5 are duplicates.No action to be taken for rows where value in column 5 is unique.
Second point : For... (1 Reply)
Discussion started by: as7951
1 Replies
10. Shell Programming and Scripting
Hello,
I am trying to store sum of a column as a new column inside a file but have to find the column names dynamically
I/p
c1,c2,c3,c4,c5
10,20,30,40,50
20,30,40,50,60
If i want to find sum only column c1, c3 and output it as c6,c7
O/p
c1,c2,c3,c4,c5,c6,c7
10,20,30,40,50,30,70... (6 Replies)
Discussion started by: mkathi
6 Replies
LEARN ABOUT SUSE
gnutls_pkcs12_bag_get_key_id
gnutls_pkcs12_bag_get_key_id(3) gnutls gnutls_pkcs12_bag_get_key_id(3)
NAME
gnutls_pkcs12_bag_get_key_id - This function gets the key ID from the bag element
SYNOPSIS
#include <gnutls/pkcs12.h>
int gnutls_pkcs12_bag_get_key_id(gnutls_pkcs12_bag_t bag, int indx, gnutls_datum_t * id);
ARGUMENTS
gnutls_pkcs12_bag_t bag
The bag
int indx The bag's element to add the id
gnutls_datum_t * id
where the ID will be copied (to be treated as const)
DESCRIPTION
This function will return the key ID, of the specified bag element. The key ID is usually used to distinguish the local private key and
the certificate pair.
RETURNS
On success, GNUTLS_E_SUCCESS is returned, otherwise a negative error value. or a negative value on error.
REPORTING BUGS
Report bugs to <bug-gnutls@gnu.org>. GnuTLS home page: http://www.gnu.org/software/gnutls/ General help using GNU software:
http://www.gnu.org/gethelp/
COPYRIGHT
Copyright (C) 2008 Free Software Foundation.
Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.
SEE ALSO
The full documentation for gnutls is maintained as a Texinfo manual. If the info and gnutls programs are properly installed at your site,
the command
info gnutls
should give you access to the complete manual.
gnutls 2.8.6 gnutls_pkcs12_bag_get_key_id(3)