Sponsored Content
Top Forums Shell Programming and Scripting Parsing with Name value pair and creating a normalized file Post 302598627 by aigles on Wednesday 15th of February 2012 03:16:58 AM
Old 02-15-2012
A solution with awk :
Code:
awk '
$4 !~ /&/ {
    print;
    next;
}
{
    out = $1 OFS $2 OFS $3;
    kvc = split($4, kv, /&/);
    for (i=2; i<=kvc; i++) {
        v = kv[i];
        sub(/.*=/, "", v);
        out = out OFS v;
    }
    print out;
}
' OFS=',' inputfile

Output (from your sample datas) :
Code:
event_id   date time payload
1329130951,20120214,22.30.40,eBayRtmToolRefreshConfiguration,INFO,5009153470691470889,d-sjc-00530678,tuhuynh@ebay.com,Windows+2003,5.2,x86,PRODUCTION,2.1.2300,Realtime%20Messaging%20Management%20Tool,Web,96764,96764,559153152,94383248,464769904

Jean-Pierre.
 

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Parsing of file for Report Generation (String parsing and splitting)

Hey guys, I have this file generated by me... i want to create some HTML output from it. The problem is that i am really confused about how do I go about reading the file. The file is in the following format: TID1 Name1 ATime=xx AResult=yyy AExpected=yyy BTime=xx BResult=yyy... (8 Replies)
Discussion started by: umar.shaikh
8 Replies

2. Shell Programming and Scripting

Sort files as pair file

Hello, I am wondering if there is a way to sort file in directory by pair name : I am looking to get the extension .txt above the .archlike this if possible liste_NATIVE_HINDCAST_PSY1V2R2_R20120314.txt flag.NATIVE_HINDCAST_PSY1V2R2.R20120314.arch... (4 Replies)
Discussion started by: Aswex
4 Replies

3. Shell Programming and Scripting

Help with datafile parsing and creating spreadsheet

I have a datafile containing data in the following format name1,employee_number1,cell1,home1,fax1 name2,employee_number2,cell2,home2,fax2 name3,employee_number3,cell3,home3,fax3 name4,employee_number4,cell4,home4,fax4 name5,employee_number5,cell5,home5,fax5 ... ... .... I would like... (6 Replies)
Discussion started by: inditopgun
6 Replies

4. UNIX for Dummies Questions & Answers

Deleting a file with no corresponding pair

Hi, I am working with 2 sets of files (*csv and *asc) and I wanted to delete asc file with no corresponding csv counterpart. I did tried it manually but its been difficult working with a longer list of files. sample files in directory 20120601.csv 20120601_f1.asc 20120603.csv 20120602_f1.asc... (3 Replies)
Discussion started by: ida1215
3 Replies

5. Shell Programming and Scripting

Parsing a name Value pair file

Hi, I have a file having rows as Row1 : model=.1.3.6.1.4.1.9.1.1047,location=abc, pollgrp=PG_CISCO4, ifindex=3, ip=10.10.10.1,parttype=Interface, devtype=Router,part=GigabitEthernet0/1,ifmtu=1520 Row2 :... (2 Replies)
Discussion started by: mksuneel
2 Replies

6. Shell Programming and Scripting

Parsing a log file and creating a report script

The log file is huge and lot of information, i would like to parse and make a report . below is the log file looks like: REPORT DATE: Mon Aug 10 04:16:17 CDT 2017 SYSTEN VER: v1.3.0.9 TERMINAL TYPE: prod SYSTEM: nb11cu51 UPTIME: 04:16AM up 182 days 57 mins min MODEL, TYPE, and SN:... (8 Replies)
Discussion started by: amir07
8 Replies

7. Programming

Calculate ratios for each pair in a given file

Hello, My input file looks like this #CHROM POS ID REF ALT QUAL FILTER INFO FORMAT Individual1 Individual2 Individual3 Individual4 Individual5 Individual6 22 10000 ID1 A ... (0 Replies)
Discussion started by: nans
0 Replies
STEREO3D(1)						      General Commands Manual						       STEREO3D(1)

NAME
stereo3d - render a Raster3D scene as a side-by-side stereo pair SYNOPSIS
stereo3d [options] [-png [outfile.png ]] < infile.r3d > outfile.png stereo3d [options] -tiff [outfile.tiff] < infile.r3d > outfile.tiff stereo3d is a shell script that renders a single Raster3D input file as a side-by-side stereo pair. stereo3d uses the Raster3D utilities normal3d and render, and the ImageMagick image processing package. Intermediate scratch files are created in directory TMPDIR, if defined, otherwise in /usr/tmp. The right eye and left eye views are separately rendered, optionally given black borders, and merged to form a single side-by-side stereo pair. Input is from stdin, output is to stdout unless a filename is given as an argument to the -png or -tiff options. EXAMPLES
If the following line would render a single image: render -tiff single.tiff < input.r3d then the following line would render the same scene as a stereo pair instead: stereo3d -tiff stereo.tiff < input.r3d OPTIONS
The options below are specific to stereo3d. All other options, e.g. -labels or -gamma 1.2 are passed through to the render program. -angsep By default the stereo effect is generated by a shear operation. The -angsep option creates stereo by using angular separation instead. Neither option is perfect: the default handles shadows badly, and the -angsep option blurs specular highlights. -border By default the left and right images are placed next to each other with no intervening space and no frame around them. The -border option requests a 4 pixel wide black border separating and surrounding the component images. SOURCE
web URL: http://www.bmsc.washington.edu/raster3d/raster3d.html contact: Ethan A Merritt University of Washington, Seattle WA 98195 merritt@u.washington.edu SEE ALSO
normal3d(l), render(l), raster3d(l) AUTHORS
Ethan A Merritt. Raster3D 19 Dec 2010 STEREO3D(1)
All times are GMT -4. The time now is 11:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy