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
Business::OnlinePayment::PaymenTech(3pm)		User Contributed Perl Documentation		  Business::OnlinePayment::PaymenTech(3pm)

NAME
Business::OnlinePayment::PaymenTech - Chase Paymentech backend for Business::OnlinePayment SYNOPSIS
$trans = new Business::OnlinePayment('PaymenTech', merchant_id => "000111222333", terminal_id => "001", currency => "USD", # CAD, MXN ); $trans->content( login => "login", password => "password", type => "CC", card_number => "5500000000000004", expiration => "0211", address => "123 Anystreet", city => "Sacramento", zip => "95824", action => "Normal Authorization", amount => "24.99", ); $trans->submit; if($trans->is_approved) { print "Approved: ".$trans->authorization; } else { print "Failed: ".$trans->error_message; } NOTES
Electronic check processing and recurring billing are not yet supported. AUTHOR
Mark Wells, mark@freeside.biz SEE ALSO
perl(1). Business::OnlinePayment. perl v5.10.1 2010-10-11 Business::OnlinePayment::PaymenTech(3pm)