Sponsored Content
Full Discussion: Adding column
Top Forums Shell Programming and Scripting Adding column Post 302912181 by RudiC on Wednesday 6th of August 2014 11:33:09 AM
Old 08-06-2014
Try
Code:
awk     'NR==1  {print "TS\tDURATION\tDS_WKLDNM\tOBJNM\tVALUE";next}
                {$2="3600\t"$2;$3="INTERFACE_C\t" sprintf("%d",$3)}
         1
        ' FS="\t" OFS="\t" file
TS    DURATION    DS_WKLDNM    OBJNM    VALUE
30/07/2014 15:00:00 3600    atl-qa-agg-sw01.hernet1/13   INTERFACE_C    1000000000
30/07/2014 15:00:00 3600    atl-qa-agg-sw01.Ethernet1/14 INTERFACE_C    1000000000
30/07/2014 15:00:00 3600    atl-qa-agg-sw01.Ethernet1/15 INTERFACE_C    1000000000
30/07/2014 15:00:00 3600    atl-qa-agg-sw01.Ethernet1/16 INTERFACE_C    1000000000
30/07/2014 15:00:00 3600    atl-qa-agg-sw01.Ethernet1/17 INTERFACE_C    1000000000
30/07/2014 15:00:00 3600    atl-qa-agg-sw01.Ethernet1/18 INTERFACE_C    1000000000

 

10 More Discussions You Might Find Interesting

1. 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

2. UNIX for Dummies Questions & Answers

adding a column

Hi everybody, I've got a file with 36074 fields. I need to insert an additional new columns 2,3,4 and 5 after the first field. The columns to insert are the same for all the lines: it's "1" doe the new field 2 and "0" for the rest. I did have a look in the forum and the suggested solution I... (7 Replies)
Discussion started by: zajtat
7 Replies

3. Shell Programming and Scripting

Adding column

Hello, I'm struggling with the following problem in sh script: Adding a column to the right-end of a file ("master-file": non-constant column number, tab and linux formatted) where the column is the 4th one of file1 (space and DOS formatted) Changing the header of column 4 of file 1 at the... (4 Replies)
Discussion started by: lco
4 Replies

4. 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

5. UNIX for Dummies Questions & Answers

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

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... (1 Reply)
Discussion started by: Vavad
1 Replies

6. Shell Programming and Scripting

Adding a specified value to a specified column - awk?

Hi everyone! I sometimes need to do some simple arithmetics, like adding a number to a certain column of a file. So I wrote a small function in the .bashrc file, which looks like this shifter() { COL=$1 VAL=$2 FILE=$3 cp $FILE $FILE.shifted awk 'NF==4 {$(( $COL )) = $(( $COL ))... (6 Replies)
Discussion started by: radudownload
6 Replies

7. Shell Programming and Scripting

Adding of two column values

Hi cat /tmp/xx.txt 1 4 1 5 1 6 2 1 2 1 2 1 i want to add the values of 2nd column resepect to 1st column values..for 1 in 1st column i need sum of all the values in 2nd column ..pls tell me hw to do it?? (8 Replies)
Discussion started by: Aditya.Gurgaon
8 Replies

8. Shell Programming and Scripting

Adding values of a column based on another column

Hello, I have a data such as this: ENSGALG00000000189 329 G A 4 2 0 ENSGALG00000000189 518 T C 5 1 0 ENSGALG00000000189 1104 G A 5 1 0 ENSGALG00000000187 3687 G T 5 1 0 ENSGALG00000000187 4533 A T 4 2 0 ENSGALG00000000233 5811 T C 4 2 0 ENSGALG00000000233 5998 C A 5 1 0 I want to... (3 Replies)
Discussion started by: Homa
3 Replies

9. Shell Programming and Scripting

Special column adding

Hi Team, I would like to add two dummy columns at the end of the file. I know how to add the columns using awk . Here is my problem. we have bit strange delimiter when I od -bc it shows 244 as its binary value. 0002200 060 244 060 244 060 244 066 065 244 060 244 244 012 0... (1 Reply)
Discussion started by: gvkumar25
1 Replies

10. Shell Programming and Scripting

Adding a column

Hello , My requirement is to add additional column sequentially to a text file based on the column value - i/p file id1|varchar id2|varchar id3|number id4|number id5|date id6|date --------------------------------------- o/p file colv1|id1 (if second column value is varchar then... (3 Replies)
Discussion started by: Pratik4891
3 Replies
AND.CONF(5)                                                        File Formats                                                        AND.CONF(5)

NAME
/etc/and.conf - general configuration parameters for the auto nice daemon. VERSION
This manual page documents and.conf for and version 1.2.2. DESCRIPTION
This is the general configuration file for and. It stores settings like the default nice level, the renice intervals, the three stages of renicing, and the affinity of the priority database, i.e. the weight of (user, group, command) when resolving nice levels from the data- base. These settings are described below. Comments start with a # in the first column. Empty lines are ignored. Unlike with other configuration files, lines cannot be concatenated with a backslash. Furthermore, this file is case sensitive. and allows for host-specific sections in the configuration file. These work as lines of the form on somehost and work as follows: the parser determines if the host name (as returned by gethostname) matches the extended regular expression that follows the on keyword. If it does, it just keeps processing the file as if nothing had happened. If it does not match, however, everything up to the next on keyword is skipped. So if you want to end a host-specific section, you must write on .* (which matches all hosts) to switch back to normal. Don't forget to kill -HUP the auto nice daemon to enable the changes. SETTINGS
defaultnice The default nice level. A number between 0 and 19. Jobs for which no entry can be found in /etc/and.priorities are reniced to this level, regardless of the CPU time they've used so far. If you prefer to renice unknown jobs gradually, you can do so by supplying three asterisks as (user, group, command) tuple in /etc/and.priorities. The default nice level is 0 interval The default interval between nice checks of the auto nice daemon, in seconds. This value can be overridden by the -i command-line option of and. The default interval is 60 seconds. lv1time lv2time lv3time Ranges for the nice levels. Jobs with less than lv1time seconds CPU time are not reniced; jobs between lv1time and lv2time seconds are reniced to the first level in an.priorities; jobs between lv2time and lv3time seconds to the second level; jobs with more than lv3time seconds are reniced to the third level. Defaults are 120 , 1200 , and 3600 seconds. minuid, mingid Minimum user id and group id to be considered for renicing. Processes whose user id is below minuid are left alone, as are processes with a group id of below mingid. (Note that even if you set minuid to zero, root processes are left alone.) affinity Strategy for picking the right priority entry for a user/group/job triple. The strategy is a permutation of "cgu", "c"ommand, "g"roup, "u"ser. The order specifies the affinity of the priority lookup method. Suppose you have an entry for all jobs of user foo, another entry for all jobs of group bar, and yet another entry for the command baz. Furthermore suppose user foo (who happens to belong to group bar ) starts a job named baz -- which entry should be chosen? This is what the affinity setting means, for example "cug" means an exact match of the command has priority over both an exact match of the user and the group. The default affinity is "cug", which is probably sensible for most cases, since it's the job which takes up CPU time, not the user or group ID. EXAMPLES
Default Configuration # This is the default configuration: defaultnice 0 interval 60 lv1time 300 lv2time 1800 lv3time 3600 affinity cug minuid 0 mingid 0 Default Configuration, with terminals # Normal default configuration for all defaultnice 0 interval 60 lv1time 300 lv2time 1800 lv3time 3600 # Hosts foo, bar, baz are terminals and must # be more responsive, so earlier renice. on (foo|bar) lv1time 120 lv2time 600 lv3time 1200 on .* # This is for all hosts again affinity cug Group-specific Hosts defaultnice 0 interval 60 lv1time 300 lv2time 1800 lv3time 3600 # Normal affinity for all hosts. affinity cug # Hosts bar, baz belong to group foo, which # is privileged on these hosts, so override # affinity. (Note regexp!) on ba[rz] affinity guc on .* minuid 500 mingid 100 FILES
/etc/and.conf General configuration file. Stores default nice level, default interval, the "time zones" and the database lookup affinity. This is what this manual page is about. SEE ALSO
and(8), and.priorities(5), kill(1), regex(7), renice(8) INTERNET
http://and.sourceforge.net/ AUTHOR
The auto nice daemon and this manual page were written by Patrick Schemitz <schemitz@users.sourceforge.net> Unix 27 Mar 2005 AND.CONF(5)
All times are GMT -4. The time now is 08:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy