Sponsored Content
Top Forums Shell Programming and Scripting Transpose data as rows using awk Post 302887885 by ravlapo on Tuesday 11th of February 2014 11:02:22 AM
Old 02-11-2014
Transpose data as rows using awk

Hi I have below requirement, need help

One file contains the meta data information and other file would have the data, match the column from file1 and with file2 and extract corresponding column value and display in another file

File1:
Code:
CUSTTYPECD
COSTCENTER
FNAME
LNAME
SERVICELVL

File2:
Code:
CUSTTYPECD:B|FNAME:JOHN|LNAME:PETER
CUSTTYPECD:B|COSTCENTER:11014|FNAME:RAJ|LNAME:KUMAR|SERVICELVL:1501
CUSTTYPECD:A|FNAME:ANDREW|LNAME:BOB|SERVICELVL:1501

Output:
Code:
CUSTTYPECD|COSTCENTER|FNAME|LNAME|SERVICELVL
B|null|JOHN|PETER|null
B|11014|RAJ|KUMAR|1501
A|null|ANDREW|BOB|1501

Note: Second file has missing column values and that could repeat through the file any of the column and column value corresponding to that could be missed.

Any help is greatly appreciated..

Thanks

Last edited by Don Cragun; 02-11-2014 at 12:21 PM.. Reason: Add CODE tags.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to transpose data elements in awk

Hi, I have an input data file :- Test4599,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,2,2,Rain Test90,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,Not Rain etc.... I wanted to transpose these data to:-... (2 Replies)
Discussion started by: ahjiefreak
2 Replies

2. Shell Programming and Scripting

How to transpose a table of data using awk

Hi. I have this data below:- v1 28 14 1.72414 1.72414 1.72414 1.72414 1.72414 v2 77 7 7.47126 6.89655 6.89655 6.89655 6.89655 v3 156 3 21.2644 21.2644 20.6897 21.2644 20.6897 v4 39 3 1.72414 1.72414 1.72414 1.72414 1.72414 v5 155 1 21.2644 23.5632 24.1379 23.5632 24.1379 v6 62 2 2.87356... (2 Replies)
Discussion started by: ahjiefreak
2 Replies

3. Shell Programming and Scripting

Transpose columns to Rows : Big data

Hi, I did read a few posts on the subjects, tried out a few solutions, but did not solve my problem. https://www.unix.com/302121568-post11.html https://www.unix.com/shell-programming-scripting/137953-large-file-columns-into-rows-etc-4.html Please help. Problem very similar to the second link... (15 Replies)
Discussion started by: genehunter
15 Replies

4. Shell Programming and Scripting

awk transpose rows to column

Need to transpose in awk rows to column like this: input: A1,6,5,4 3,2,1, A2,8,7,9,10,11,12,13,14 A3,1,2,3,5,7,8,9 A4,9,4,8,1,5,3, output: A1,1 A1,2 A1,4 ... A2,7 A2,8 ... A3,1 A3,2 ... A4,1 A4,3 (5 Replies)
Discussion started by: sdf
5 Replies

5. Shell Programming and Scripting

Transpose Data from Columns to rows

Hello. very new to shell scripting and would like to know if anyone could help me. I have data thats being pulled into a txt file and currently have to manually transpose the data which is taking a long time to do. here is what the data looks like. Server1 -- Date -- Other -- value... (7 Replies)
Discussion started by: Mikes88
7 Replies

6. Shell Programming and Scripting

awk to transpose preceding row to 1st column of next rows

Gurus: How can I transpose the output below to a format in which I can plot a graph to show VSZ memory usage by PIDs? stdout: Tue Jan 22 07:29:19 CUT 2013 42336296 1841272 java wilyadm 21889232 438616 jlaunch sidadm 42532994 414336 jlaunch sidadm Tue Jan 22 07:49:20 CUT 2013... (1 Reply)
Discussion started by: ux4me
1 Replies

7. Shell Programming and Scripting

Transpose Column of Data to Rows

I can no longer find my commands, but I use to be able to transpose data with common fields from a single column to rows using a command line. My data is separated as follows: NAME=BOB ADDRESS=COLORADO PET=CAT NAME=SUSAN ADDRESS=TEXAS PET=BIRD NAME=TOM ADDRESS=UTAH PET=DOG I would... (7 Replies)
Discussion started by: docdave78
7 Replies

8. Shell Programming and Scripting

awk to transpose every 7 rows into columns

input: a1 a2 a3 a4 a5 a6 a7 b1 b2 b3 .. b7 .. z1 .. z7 (12 Replies)
Discussion started by: ux4me
12 Replies

9. Shell Programming and Scripting

Transpose comma delimited data in rows to columns

Hello, I have a bilingual database with the following structure a,b,c=d,e,f The right half is in a Left to right script and the second is in a Right to left script as the examples below show What I need is to separate out the database such that the first word on the left hand matches the first... (4 Replies)
Discussion started by: gimley
4 Replies

10. UNIX for Beginners Questions & Answers

How to transpose pieces of data in a column to multiple rows?

Hello Everyone, I am very new to the world of regular expressions. I am trying to use grep/sed for the following: Input file is something like this and there are multiple such files: abc 1 2 3 4 5 ***END*** abc 6 7 8 9 ***END*** abc 10 (2 Replies)
Discussion started by: shellnewuser
2 Replies
delaunay(1)						  GNU Triangulated Surface utils					       delaunay(1)

NAME
delaunay - constructs the constrained Delaunay triangulation of the input SYNOPSIS
delaunay [OPTIONS] < file.gts DESCRIPTION
This manual page documents briefly the delaunay command. This command constructs the constrained Delaunay triangulation of the input OPTIONS
This program follow the usual GNU command line syntax, with long options starting with two dashes (`-'). A summary of options is included below. -b, --hull Do not keep convex hull. -e, --noconst Do not add constrained edges. -S, --split Split constraints (experimental). -H, --holes Remove holes from the triangulation. -d, --duplicates Remove duplicate vertices. -r, --randomize Shuffle input vertex list. -c, --check Check Delaunay property. -f FNAME, --files=FNAME Generate evolution files. -o, --conform Generate conforming triangulation. -s N, --steiner=N Maximum number of Steiner points for conforming triangulation (default is no limit). -q Q, --quality=Q Set the minimum acceptable face quality. -a A, --area=A Set the maximum acceptable face area. -v, --verbose Print statistics about the triangulation. -h, --help Display the help and exit. AUTHOR
delaunay was written by Stephane Popinet <popinet@users.sourceforge.net>. This manual page was written by Ruben Molina <rmolina@udea.edu.co>, for the Debian project (but may be used by others). June 2, 2008 delaunay(1)
All times are GMT -4. The time now is 07:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy