Interesting .. How do I handle this in Unix / Perl ?


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Interesting .. How do I handle this in Unix / Perl ?
# 1  
Old 10-11-2007
Interesting .. How do I handle this in Unix / Perl ?

This is how my input file is ( comma sepertated ):-

L,id,name,address,city,measure_id_1,measrure_id_qty_1,measure_id_2,measure_id_qty_2
D,123,vvc,wwwew wdwe,hou,zip,77057,tel,832
L,id,name,address,city,measure_id_1,measrure_id_qty_1
D,222,abc,dsdsd wwew wdwe,ny,zip,77057
L,id,city,measure_id_1,measrure_id_qty_1
D,333,dallas,state,tx

i.e It has lable record followed by the detail record, e.g for first set the id is 123, name is vvcm address is "wwwew wdwe"... however, measure_id_1 is "zip" and measrure_id_qty_1 is "77057" which means zip is 77057. similarily tel is 832.

Now the output I want is like this ...

id,name,address,city,zip,tel,state
123,vvc,wwwew wdwe,hou,77057,832,{NULL}
222,abc,dsdsd wwew wdwe,ny,77057,{NULL},{NULL}
333,{NULL},{NULL},dallas,{NULL},{NULL},tx

what seems to be interesting is I do not have to scan for column headers in L record only but I need to scan the detail records also for the column headers ....

If anyone knows the solution either in shell,awk, perl .. anything is welcome ..

Thanks ...
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Interesting awk/Perl/sed parsing challenge

I have a log with entries like: out/target/product/imx53_smd/obj/STATIC_LIBRARIES/libwebcore_intermediates/Source/WebCore/bindings/V8HTMLVideoElement.cpp : target thumb C++: libwebcore <=... (8 Replies)
Discussion started by: glev2005
8 Replies

2. Shell Programming and Scripting

Help needed on Perl Script to Handle Log files that are rotated using logrotate

Hello all, I am working on a perl script which will read weblogic logfile and send the error messages to Zenoss Monitoring tool. At present the script works and it can able to send the error messages to Zenoss. The problem comes when the logrotate has been applied to the weblogic log file. At... (3 Replies)
Discussion started by: kar_333
3 Replies

3. Shell Programming and Scripting

How to handle 64 bit arithmetic operation at 32 bit compiled perl interpreter?H

Hi, Here is the issue. From the program snippet I have Base: 0x1800000000, Size: 0x3FFE7FFFFFFFF which are of 40 and 56 bits. SO I used use bignum to do the math but summing them up I always failed having correct result. perl interpreter info, perl, v5.8.8 built for... (0 Replies)
Discussion started by: rrd1986
0 Replies

4. UNIX for Dummies Questions & Answers

Difference between handle to the thread HANDLE and thread identifier pthread_t

This question might be silly but its confusing me a bit: What is the difference between handle to the thread HANDLE and thread identifier pthread_t? ---------- Post updated at 01:52 PM ---------- Previous update was at 01:48 PM ---------- Sorry I saw details and HANDLE is in windows and... (0 Replies)
Discussion started by: rupeshkp728
0 Replies

5. Shell Programming and Scripting

perl/unix: script in command line works but not in perl

so in unix this command works works and shows me a list of directories find . -name \*.xls -exec dirname {} \; | sort -u | > list.txt but when i try running a perl script to run this command my $query = 'find . -name \*.xls -exec dirname {} \; | sort -u | > list.txt';... (2 Replies)
Discussion started by: kpddong
2 Replies

6. Solaris

Before I delete any file in Unix, How can I check no open file handle is pointing to that file?

I know how to check if any file has a unix process using a file by looking at 'lsof <fullpath/filename>' command. I think using lsof is very expensive. Also to make it accurate we need to inlcude fullpath of the file. Is there another command that can tell if a file has a truely active... (12 Replies)
Discussion started by: kchinnam
12 Replies

7. Shell Programming and Scripting

ftp from windows to unix using a perl script on unix machine

i need to ftp a file from windows to a unix machine by executing a sript(perl/shell/php) from that unix machine.i can also use HTML and javascript to build forms. (3 Replies)
Discussion started by: raksha.s
3 Replies

8. Shell Programming and Scripting

[PERL] Running unix commands within Perl Scripts

I understand that in order to run basic unix commands I would normally type at the prompt, I would have to use the following format system(ls -l); or exec(ls -l); But when I actually try to use the command, the script fails to compile and keeps telling me there is an error with this line. ... (1 Reply)
Discussion started by: userix
1 Replies

9. Shell Programming and Scripting

how to handle sql loader errors in unix

hi all, how to handle sql loader errors in unix shell ?? thanks in advance gemini (3 Replies)
Discussion started by: gemini106
3 Replies
Login or Register to Ask a Question
Regexp::Common::URI::tel(3)				User Contributed Perl Documentation			       Regexp::Common::URI::tel(3)

NAME
Regexp::Common::URI::tel -- Returns a pattern for telephone URIs. SYNOPSIS
use Regexp::Common qw /URI/; while (<>) { /$RE{URI}{tel}/ and print "Contains a telephone URI. "; } DESCRIPTION
$RE{URI}{tel} Returns a pattern that matches tel URIs, as defined by RFC 2806. Under "{-keep}", the following are returned: $1 The complete URI. $2 The scheme. $3 The phone number, including any possible add-ons like ISDN subaddress, a post dial part, area specifier, service provider, etc. $RE{URI}{tel}{nofuture} As above (including what's returned by "{-keep}"), with the exception that future extensions are not allowed. Without allowing those future extensions, it becomes much easier to check a URI if the correct syntax for post dial, service provider, phone context, etc has been used - otherwise the regex could always classify them as a future extension. REFERENCES
[RFC 1035] Mockapetris, P.: DOMAIN NAMES - IMPLEMENTATION AND SPECIFICATION. November 1987. [RFC 2396] Berners-Lee, Tim, Fielding, R., and Masinter, L.: Uniform Resource Identifiers (URI): Generic Syntax. August 1998. [RFC 2806] Vaha-Sipila, A.: URLs for Telephone Calls. April 2000. SEE ALSO
Regexp::Common::URI for other supported URIs. AUTHOR
Damian Conway (damian@conway.org) MAINTAINANCE
This package is maintained by Abigail (regexp-common@abigail.be). BUGS AND IRRITATIONS
Bound to be plenty. LICENSE and COPYRIGHT This software is Copyright (c) 2001 - 2009, Damian Conway and Abigail. This module is free software, and maybe used under any of the following licenses: 1) The Perl Artistic License. See the file COPYRIGHT.AL. 2) The Perl Artistic License 2.0. See the file COPYRIGHT.AL2. 3) The BSD Licence. See the file COPYRIGHT.BSD. 4) The MIT Licence. See the file COPYRIGHT.MIT. perl v5.18.2 2013-03-08 Regexp::Common::URI::tel(3)