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)
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)
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)
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)
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)
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)
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)
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)
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)
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 DEBIAN
knife-data-bag
KNIFE-DATA-BAG(1) Chef Manual KNIFE-DATA-BAG(1)NAME
knife-data-bag - Store arbitrary data on a Chef Server
SYNOPSIS
knife data bag sub-command (options)
DESCRIPTION
Data bags are stores of arbitrary JSON data. Each data bag is a collection that may contain many items. Data Bag Items are indexed by the
Chef Server and can be searched via knife-search(1).
Data bags are available to all nodes configured by chef-client(8), and are therefore a convenient mechanism to store global information,
such as lists of administrative accounts that should be configured on all hosts.
DATA BAG SUB-COMMANDSCREATE
knife data bag create bag name [item id] (options)
-s, --secret SECRET
A secret key used to encrypt the data bag item. See encryption support below.
--secret-file SECRET_FILE
The path to a file containing the secret key to be used to encrypt the data bag item.
If item id is given, creates a new, empty data bag item and opens it for editing in your editor. The data bag will be created if it does
not exist.
If item id is not given, the data bag will be created.
DELETE
knife data bag delete bag name [item id] (options)
Delete a data bag, or an item from a data bag.
EDIT
knife data bag edit bag name item id (options)
-s, --secret SECRET
A secret key used to encrypt the data bag item. See encryption support below.
--secret-file SECRET_FILE
The path to a file containing the secret key to be used to encrypt the data bag item.
Edit an item in a data bag.
FROM FILE
knife data bag from file bag name file (options)
knife data bag from file bag name file1 file2 file3 (options)
knife data bag from file bag name folder (options)
-s, --secret SECRET
A secret key used to encrypt the data bag item. See encryption support below.
--secret-file SECRET_FILE
The path to a file containing the secret key to be used to encrypt the data bag item.
Load a data bag item from a JSON file. If file is a relative or absolute path to the file, that file will be used. Otherwise, the file
parameter is treated as the base name of a data bag file in a Chef repository, and knife will search for the file in
./data_bags/bag_name/file. For example knife data bag from file users dan.json would attempt to load the file ./data_bags/users/dan.json.
LIST
knife data bag list (options)
-w, --with-uri
Show corresponding URIs
Lists the data bags that exist on the Chef Server.
SHOW
knife data bag show BAG [ITEM] (options)
-s, --secret SECRET
A secret key used to encrypt the data bag item. See encryption support below.
--secret-file SECRET_FILE
The path to a file containing the secret key to be used to encrypt the data bag item.
Show a specific data bag or an item in a data bag. The output will be formatted according to the --format option.
ENCRYPTION SUPPORT
Data Bag Items may be encrypted to keep their contents secret. This may be desireable when storing sensitive information such as database
passwords, API keys, etc.
Data Bag Item encryption uses the AES-256 CBC symmetric key algorithm.
CAVEATS: Keys are not encrypted; only values are encrypted. The "id" of a Data Bag Item is not encrypted, since it is used by Chef Server
to store the item in its database. For example, given the following data bag item:
{"id": "important_passwords", "secret_password": "opensesame"}
The key "secret_password" will be visible to an evesdropper, but the value "opensesame" will be protected. Both the key "id" and its value
"important_passwords" will be visible to an evesdropper.
Chef Server does not provide a secure mechanism for distributing encryption keys.
SEE ALSO knife-search(1)AUTHOR
Chef was written by Adam Jacob adam@opscode.com with many contributions from the community.
DOCUMENTATION
This manual page was written by Joshua Timberman joshua@opscode.com. Permission is granted to copy, distribute and / or modify this docu-
ment under the terms of the Apache 2.0 License.
CHEF
Knife is distributed with Chef. http://wiki.opscode.com/display/chef/Home
Chef 10.12.0 June 2012 KNIFE-DATA-BAG(1)