Sponsored Content
Top Forums Shell Programming and Scripting Manipulating a header file using awk or sed Post 302401544 by alister on Saturday 6th of March 2010 05:59:25 PM
Old 03-06-2010
Hi, eo29:

Code:
$ cat data
Available Assigned Maximum
Space Space Warp
(MB) (MB) (Factor)

$ awk '{for (i=1; i<=NF; i++) a[i]=a[i] (a[i]?" ":"") $i} END {while (a[++j]) printf("%s%s", a[j], a[j+1]?"#":"\n")}' data
Available Space (MB)#Assigned Space (MB)#Maximum Warp (Factor)

Regards,
Alister
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Manipulating awk $variables using sed?

I have been searching around the forums here trying to find a solution to my problem but not getting anywhere but closer to baldness. I have a 20 column pipe "|" seperated text file. The 14th variable doesnt always exist, but will have the format of YYYYMM or YYYY if it does. I need to take... (2 Replies)
Discussion started by: r0sc0
2 Replies

2. Shell Programming and Scripting

awk/sed column replace using column header - help

$ cat log.txt Name Age Sex Lcation nfld alias xsd CC 25 M XYZ asx KK Y BB 21 F XAS awe SS N SD 21 M AQW rty SD A How can I replace the column with header "Lcation" with the column with header "alias" and delete the "alias" column? so that the final output will become: Name Age Sex... (10 Replies)
Discussion started by: jkl_jkl
10 Replies

3. Shell Programming and Scripting

manipulating Fields in file using SED

Hi, I have two issues: I have one file say file1.dat and its over 3GB. It contains pipe delimited fields. The first line in the file is the header field which tells the column names etc. and from second line it's the data fileds with pipe delimited. Something like below: ... (5 Replies)
Discussion started by: rkumar28
5 Replies

4. Shell Programming and Scripting

Manipulating the etc/passwd file with sed

How can i use sed to extract the user name and home directory from the /etc/passwd/ file on my server. (11 Replies)
Discussion started by: Pauline mugisha
11 Replies

5. Shell Programming and Scripting

Manipulating a variable using sed (solved)

Hi, My variable has value as this: tvar1="bool_risk_enabled" Boolean "true" Now I need to replace this true with false. Which is the best way to do this? Can we do this with sed command? Please help me. ---------- Post updated at 05:23 PM ---------- Previous update was at 05:00 PM... (2 Replies)
Discussion started by: pravintse
2 Replies

6. Shell Programming and Scripting

Adding header to sub files after splitting the main file using AWK

Hi Folks, I have a file like: mainfile.txt: ------------- file1 abc def xyz file1 aaa pqr xyz file2 lmn ghi xyz file2 bbb tuv xyz I need output having two files file1 and file2. file1: ------ Name State Country abc def xyz aaa pqr xyz file2: (3 Replies)
Discussion started by: tanmay.gemini
3 Replies

7. Shell Programming and Scripting

Manipulating xyz file with awk-if-else or sed

Hi forum, I am really hoping somebody can please help me here. I have a dataset in xyz format, with longitude as x, latitude as y and data readings as z. eg. 0 90 -8 1 90 23 2 90 -4 etc etc etc What i am looking to do is format the data so that x and y are untouched, however in... (2 Replies)
Discussion started by: shlam16
2 Replies

8. Shell Programming and Scripting

Average, min and max in file with header, using awk

Hi, I have a file which looks like this: FID IID MISS_PHENO N_MISS N_GENO F_MISS 12AB43131 12AB43131 N 17774 906341 0.01961 65HJ87451 65HJ87451 N 10149 906341 0.0112 43JJ21345 43JJ21345 N 2826 906341 0.003118I would... (11 Replies)
Discussion started by: kayakj
11 Replies

9. Shell Programming and Scripting

Awk/sed script for transposing any number of rows with header row

Greetings! I have been trying to find out a way to take a CSV file with a large number of rows, and a very large number of columns (in the thousands) and convert the rows to a single column of data, where the first row is a header representing the attribute name and the subsequent series of... (3 Replies)
Discussion started by: tntelle
3 Replies

10. Shell Programming and Scripting

Creating your own Header file in awk

whether it is possible in awk to create your own header file like in C if so someone give me awk equivalent for below one $ cat foo.h int add(int a,int b) { return(a+b); } $ cat main.c #include<stdio.h> #include"foo.h" void main() { int number1=10,number2=10,number3; number3 =... (5 Replies)
Discussion started by: Akshay Hegde
5 Replies
Geo::Space(3pm) 					User Contributed Perl Documentation					   Geo::Space(3pm)

NAME
Geo::Space - A collection of various items INHERITANCE
Geo::Space is a Geo::Shape SYNOPSIS
my $island1 = Geo::Line->filled(...); my $island2 = Geo::Space->new(...); my $islands = Geo::Space->new($island1, $island2) DESCRIPTION
Where a Geo::Surface can only contains sets of nested polygons, the Space can contain anything you like: lines, points, and unrelated polygons. METHODS
Constructors $obj->new([COMPONENTS], [OPTIONS]) Geo::Space->new([COMPONENTS], [OPTIONS]) When called as instance method, some defaults are copied from the object where the call is made upon. Usually called as class method. COMPONENTS are Math::Polygon, Math::Polygon::Surface, Geo::Point, Geo::Line, Geo::Surface, Geo::Space objects. Option--Defined in--Default proj Geo::Shape see Geo::Proj::defaultProjection() . proj => LABEL Attributes $obj->component(INDEX, [INDEX, ...]) Returns the component (or components) with the specified INDEX(es). One Geo::Shape object in scalar context, and multiple in list context. $obj->components Returns a list of Geo::Shape objects, all located in this space. $obj->lines Returns a list of Geo::Line objects, which are defined as separate components. $obj->nrComponents Returns the number of components. $obj->onlyLines Returns true when all components are lines; Geo::Line objects. $obj->onlyPoints Returns true when all components are points; Geo::Point objects. $obj->onlyRings Returns true when all components are closed lines; Geo::Line objects each defined as ring. $obj->points Returns a list of Geo::Point objects, which are defined as separate components. $obj->proj See "Attributes" in Geo::Shape $obj->proj4 See "Attributes" in Geo::Shape Projections $obj->in(LABEL|'utm') See "Projections" in Geo::Shape $obj->projectOn(NICK, POINTS) See "Projections" in Geo::Shape Geometry $obj->area Returns the area enclosed by the combined components. Only useful when the points are in some orthogonal projection. $obj->bbox See "Geometry" in Geo::Shape $obj->bboxCenter See "Geometry" in Geo::Shape $obj->bboxRing([XMIN, YMIN, XMAX, YMAX, [PROJ]]) Geo::Space->bboxRing([XMIN, YMIN, XMAX, YMAX, [PROJ]]) See "Geometry" in Geo::Shape $obj->distance(OBJECT, [UNIT]) See "Geometry" in Geo::Shape $obj->perimeter The length of the outer polygons of all components. Only useful in a orthogonal coordinate systems. Display $obj->deg2dm(DEGREES, POS, NEG) Geo::Space->deg2dm(DEGREES, POS, NEG) See "Display" in Geo::Shape $obj->deg2dms(DEGREES, POS, NEG) Geo::Space->deg2dms(DEGREES, POS, NEG) See "Display" in Geo::Shape $obj->dms2deg(DMS) Geo::Space->dms2deg(DMS) See "Display" in Geo::Shape $obj->toString([PROJECTION]) Returns a string representation of the line, which is also used for stringification. example: DIAGNOSTICS
Error: distance calculation not implemented between a $kind and a $kind Only a subset of all objects can be used in the distance calculation. The limitation is purely caused by lack of time to implement this. Error: in() not implemented for a $class SEE ALSO
This module is part of Geo-Point distribution version 0.93, built on May 19, 2010. Website: http://perl.overmeer.net/geo/ All modules in this suite: "Geo::Point", "Geo::Proj4", "Geo::WKT", "Math::Polygon", "Geo::GML", "Geo::ISO19139", "Geo::EOP", "Geo::Format::Envisat", and "Geo::Format::Landsat". Please post questions or ideas to the mailinglist at http://geo-perl@list.hut.fi LICENSE
Copyrights 2005-2010 by Mark Overmeer. For other contributors see ChangeLog. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/Artistic.html perl v5.14.2 2010-05-19 Geo::Space(3pm)
All times are GMT -4. The time now is 03:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy