Sponsored Content
Full Discussion: awk script row to column
Top Forums Shell Programming and Scripting awk script row to column Post 303016117 by rdrtx1 on Thursday 19th of April 2018 11:58:56 PM
Old 04-20-2018
Code:
awk '
NR > 1 {printf ($0 ~ /^Source/) ? " " : "\n"; }
{printf $0}
END { if ($0 ~ /^Source/) print ""}
' data

This User Gave Thanks to rdrtx1 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Get value of last row and 6 column from awk

I want to get value of last row and 6 column from awk. Below is the format of my file. And RED one is my desired value. Actaully this stats usally update after every 1 hour so i want that every time i run the script i get the latest value. Ending time - 01:00:58 HOURLY CALL ATTEMPTS... (4 Replies)
Discussion started by: wakhan
4 Replies

2. UNIX for Dummies Questions & Answers

awk question row into column

I have a csv file: test1.csv with 26 columns Sample: Data collected Comp1,,,,,,,,,,,,,,,,,,,,,,,,,Average Number of Arrivals with non Zero,0,0,0,0,0,0,0,0,0,...,0 %Utilization,0.1,0.23,0.14,...,0.36 Data collected Comp2,,,,,,,,,,,,,,,,,,,,,,,,,Average Number of Arrivals with non... (2 Replies)
Discussion started by: calitiggr
2 Replies

3. Shell Programming and Scripting

AWK Script - Print a column - within a Row Range

Hi, Please read the whole thread. I have been working on this script below. It works fine, feel free to copy and test with the INPUT File below as well. example: PACKET DATA PROTOCOL CONTEXT DATA APNID PDPADD EQOSID VPAA PDPCH PDPTY PDPID 10 ... (6 Replies)
Discussion started by: panapty
6 Replies

4. Shell Programming and Scripting

Subtracting each row from the first row in a single column file using awk

Hi Friends, I have a single column data like below. 1 2 3 4 5 I need the output like below. 0 1 2 3 4 where each row (including first row) subtracting from first row and the result should print below like the way shown in output file. Thanks Sid (11 Replies)
Discussion started by: ks_reddy
11 Replies

5. Shell Programming and Scripting

awk transpose row into 2 field column

Need to transpose every 2 fields of a row into a single 2 field column. input 4 135 114 76 217 30 346 110 5 185 115 45 218 85 347 125 6 85 116 130 220 65 352 95 11 30 117 55 221 42 355 75 16 72 118 55 224 37 357 430 17 30 119 55 225 40 358 62 21 52 120 65 232 480 360 180 ....... (8 Replies)
Discussion started by: sdf
8 Replies

6. UNIX for Dummies Questions & Answers

append column and row header to a file in awk script.

Hi! Is there a way to append column and row header to a file in awk script. For example if I have Jane F 39 manager Carlos M 40 system administrator Sam F 20 programmer and I want it to be # name gend age occup 1 Jane F 39 manager 2 Carlos M ... (4 Replies)
Discussion started by: FUTURE_EINSTEIN
4 Replies

7. Shell Programming and Scripting

awk - script help: column to row format of data allignment?

Experts Good day, I have the following data, file1 BRAAGRP1 A2X B2X C2X D2X BRBGRP12 A3X B3X Z10 D09 BRC1GRP2 LO01 (4 Replies)
Discussion started by: rveri
4 Replies

8. UNIX for Dummies Questions & Answers

awk to print first row with forth column and last row with fifth column in each file

file with this content awk 'NR==1 {print $4} && NR==2 {print $5}' file The error is shown with syntax error; what can be done (4 Replies)
Discussion started by: cdfd123
4 Replies

9. Shell Programming and Scripting

Transpose column to row - awk

Hi there, I have a small csv file example below: source,cu_001,cu_001_volume,cu_001_mass,cu_002,cu_002_volume,cu_002_mass,cu_003,cu_003_volume,cu_003_mass ja116,1.33,3024000,9374400,1.54,3026200,9375123,1.98,3028000,9385512 I want to transpose columns to rows starting at the second... (3 Replies)
Discussion started by: theflamingmoe
3 Replies

10. UNIX for Beginners Questions & Answers

Script to do column to row in awk

Hi , Can anyone help me suggesting - how to do the below trick with awk Input 120 130 140 210 310 410 645 729 800 Output 120 130 140 (6 Replies)
Discussion started by: Indra2011
6 Replies
GroupInfo(3pm)						  LogReport's Lire Documentation					    GroupInfo(3pm)

NAME
Lire::Report::GroupInfo - Object that groups columns created by the same aggregator. . SYNOPSIS
my $info = $subreport->group_info( 0 ); print "Group's name: ", $info->name(), " "; print "Group's columns starts at: ", $info->index(), " "; DESCRIPTION
The Lire::Report::GroupInfo object holds the ColumnInfo objects that were created by the same aggregator. CONSTRUCTOR
new( $name ) You create a new Lire::Report::GroupInfo object by calling the create_group_info() method on one Lire::Report::TableInfo object or another Lire::Report::GroupInfo object. OBJECT METHODS
name() Returns the name of this group. This name can be used to find the aggregator (from the report specification) that is responsible for the data held in this group. row_idx() Returns the row index in which this group's categorical column's labels should be displayed in the table header. max_row_idx() parent_group_info() Returns the GroupInfo which contains this GroupInfo. This will be undef for the top-level TableInfo object. index() Returns the column's index in the table at which the columns of this group starts. This will be undef until the group info object is added to a Lire::Subreport or another Lire::Group object. children() Returns as an array, the Lire::Report::ColumnInfo and Lire::Report::GroupInfo objects contained in this group. info_by_index( $idx ) Returns the ColumnInfo or GroupInfo that is at index $idx among this GroupInfo children. group_children Returns as an array, only the Lire::Report::GroupInfo contained in this GroupInfo. column_children Returns as an array, only the Lire::Report::ColumnInfo contained in this GroupInfo. categorical_names() Returns the categorical columns' names as an array ref. create_column_info( $name, $class, $type, [$label]]) Creates a new Lire::Report::ColumnInfo object as a child of this GroupInfo. The column info attributes are initialized based on $name, $class, $type and $label. This will set the index of the ColumnInfo object. Returns the created ColumnInfo object. create_group_info( $name ) Create a Lire::Report::GroupInfo which as a child of this group. This will also set the starting column index on the GroupInfo object. The $name parameter should contain the name of the report specification aggregator that is responsible for the content of this group. Returns the created GroupInfo object. column_info_by_name( $name ) Returns the Lire::Report::ColumnInfo object that has the name $name. This method searches in the current group as well as in its subgroups. Returns undef if the column isn't found. column_info_by_col_start( $col_idx ) Returns the Lire::Report::ColumnInfo object that starts in column index $col_idx. This method searches in the current group as well as in its subgroups. Returns undef if the column isn't found in the current group. group_info( $name ) Returns the Lire::Report::GroupInfo object that has the name $name. This will be undef if it cannot be found in this group info. SEE ALSO
Lire::Report::Subreport(3pm) Lire::Report::ColumnInfo(3pm) VERSION
$Id: GroupInfo.pm,v 1.22 2006/07/23 13:16:31 vanbaal Exp $ AUTHOR
Francis J. Lacoste <flacoste@logreport.org> COPYRIGHT
Copyright (C) 2002 Stichting LogReport Foundation LogReport@LogReport.org This file is part of Lire. Lire is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program (see COPYING); if not, check with http://www.gnu.org/copyleft/gpl.html. Lire 2.1.1 2006-07-23 GroupInfo(3pm)
All times are GMT -4. The time now is 05:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy