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
Gtk2::Table(3pm)					User Contributed Perl Documentation					  Gtk2::Table(3pm)

NAME
Gtk2::Table - wrapper for GtkTable HIERARCHY
Glib::Object +----Glib::InitiallyUnowned +----Gtk2::Object +----Gtk2::Widget +----Gtk2::Container +----Gtk2::Table INTERFACES
Glib::Object::_Unregistered::AtkImplementorIface Gtk2::Buildable METHODS
widget = Gtk2::Table->new ($rows, $columns, $homogeneous=FALSE) o $rows (integer) o $columns (integer) o $homogeneous (boolean) $table->attach ($child, $left_attach, $right_attach, $top_attach, $bottom_attach, $xoptions, $yoptions, $xpadding, $ypadding) o $child (Gtk2::Widget) o $left_attach (integer) o $right_attach (integer) o $top_attach (integer) o $bottom_attach (integer) o $xoptions (Gtk2::AttachOptions) o $yoptions (Gtk2::AttachOptions) o $xpadding (integer) o $ypadding (integer) $table->attach_defaults ($widget, $left_attach, $right_attach, $top_attach, $bottom_attach) o $widget (Gtk2::Widget) o $left_attach (integer) o $right_attach (integer) o $top_attach (integer) o $bottom_attach (integer) integer = $table->get_col_spacing ($column) o $column (integer) $table->set_col_spacing ($column, $spacing) o $column (integer) o $spacing (integer) $table->set_col_spacings ($spacing) o $spacing (integer) integer = $table->get_default_col_spacing integer = $table->get_default_row_spacing boolean = $table->get_homogeneous $table->set_homogeneous ($homogeneous) o $homogeneous (boolean) $table->resize ($rows, $columns) o $rows (integer) o $columns (integer) integer = $table->get_row_spacing ($row) o $row (integer) $table->set_row_spacing ($row, $spacing) o $row (integer) o $spacing (integer) $table->set_row_spacings ($spacing) o $spacing (integer) (rows, columns) = $table->get_size Since: gtk+ 2.22 PROPERTIES
'column-spacing' (Glib::UInt : default 0 : readable / writable / private) The amount of space between two consecutive columns 'homogeneous' (boolean : default false : readable / writable / private) If TRUE, the table cells are all the same width/height 'n-columns' (Glib::UInt : default 1 : readable / writable / private) The number of columns in the table 'n-rows' (Glib::UInt : default 1 : readable / writable / private) The number of rows in the table 'row-spacing' (Glib::UInt : default 0 : readable / writable / private) The amount of space between two consecutive rows CHILD PROPERTIES
'bottom-attach' (Glib::UInt : default 1 : readable / writable / private) The row number to attach the bottom of the child to 'left-attach' (Glib::UInt : default 0 : readable / writable / private) The column number to attach the left side of the child to 'right-attach' (Glib::UInt : default 1 : readable / writable / private) The column number to attach the right side of a child widget to 'top-attach' (Glib::UInt : default 0 : readable / writable / private) The row number to attach the top of a child widget to 'x-options' (Gtk2::AttachOptions : default expand,fill : readable / writable / private) Options specifying the horizontal behaviour of the child 'x-padding' (Glib::UInt : default 0 : readable / writable / private) Extra space to put between the child and its left and right neighbors, in pixels 'y-options' (Gtk2::AttachOptions : default expand,fill : readable / writable / private) Options specifying the vertical behaviour of the child 'y-padding' (Glib::UInt : default 0 : readable / writable / private) Extra space to put between the child and its upper and lower neighbors, in pixels ENUMS AND FLAGS
flags Gtk2::AttachOptions o 'expand' / 'GTK_EXPAND' o 'shrink' / 'GTK_SHRINK' o 'fill' / 'GTK_FILL' SEE ALSO
Gtk2, Glib::Object, Glib::InitiallyUnowned, Gtk2::Object, Gtk2::Widget, Gtk2::Container COPYRIGHT
Copyright (C) 2003-2011 by the gtk2-perl team. This software is licensed under the LGPL. See Gtk2 for a full notice. perl v5.14.2 2012-05-27 Gtk2::Table(3pm)
All times are GMT -4. The time now is 02:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy