11-02-2005
How to Parse a CSV file into a Different Format
Hi
I have a CSV file with me in this format
Currency, USD, EUR,
USD, 1.00, 1.32,
EUR, 0.66, 1.00,
How do I transpose the file to get to the format below.
currency, currency, rate
USD, USD, 1.00
USD, EUR, 1.32
EUR, USD, 0.66
EUR, EUR, 1.00
Thanks for your help
We are using ksh on Unix.
Sampath
Last edited by cdesiks; 11-02-2005 at 06:19 PM..
Reason: More Info on the Shell we are using
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Folks,
I have a bit of an issue trying to obtain some data from a csv file using PERL. I can sort the file and remove any duplicates leaving only 4 or 5 rows containing data. My problem is that the data contained in the original file contains a lot more columns and when I try ro run this script... (13 Replies)
Discussion started by: lodey
13 Replies
2. Shell Programming and Scripting
I have a file, not really a csv, but containing delineated data just the same. Lets call that file "raw_data.txt". It contains data in the format of company name:fein number like this:
first company name:123456789
second company name:987654321
what i need to do is read this file, apply... (11 Replies)
Discussion started by: FreddyG
11 Replies
3. Shell Programming and Scripting
Hi,
It's been a few years since college when I did stuff like this all the time. Can someone help me figure out how to best tackle this problem? I need to parse a file full of entries that look like this:
<eq action="A" sectyType="0" symbol="PGR" exch="CA" curr="VEF" sess="NORM"... (7 Replies)
Discussion started by: Pcushing
7 Replies
4. Shell Programming and Scripting
Hi,
Our requirement is to parse the input file(.csv format). The each column in the file is delimited with comma. We need to take each column and apply some business validation rule.
If data itself contains comma, then those fields are enclosed with double quotes ("). We can see this double... (7 Replies)
Discussion started by: vfrg
7 Replies
5. Shell Programming and Scripting
Hi All,
I have an xml file with the below format.
<a>111</a><b>222</b><c>333<c><d><e>123</e><f>234</f><d><e>456</e><f>789</f>
output needed is
111,222,333,123,234
111,222,333,456,789
nawk 'BEGIN{FS="<|>"}
{print a,b,c,e,f
a=""
... (7 Replies)
Discussion started by: natalie23
7 Replies
6. Shell Programming and Scripting
#!/bin/bash
i=0
cat 1.csv | while read fileline
do
echo "$fileline"
IFS="#" flds=( $fileline )
nrofflds=${#flds}
echo "noof fields$nrofflds"
fld=0
while
do
echo "noof counter$fld"
echo "$nrofflds"
#fld1="${flds}" trying to store the content of line to fields but i... (4 Replies)
Discussion started by: barani75
4 Replies
7. Shell Programming and Scripting
Hi,
I have a file with 3 fields in csv format:
/tmp/foo/,MODIFY,bar/toto
"/tmp/foo, bar/","ATTRIB,ISDIR","toto, tata/foobar"I would like to split fields in order to obtain the following:
Line1:
/tmp/foo/
MODIFY
bar/totoLine2:
/tmp/foo, bar/
ATTRIB,ISDIR
toto, tata/foobarCan't find my way... (11 Replies)
Discussion started by: chebarbudo
11 Replies
8. Shell Programming and Scripting
Hello Expert,
I have a file in the following format:
SYNTAX_VERSION 5
MONITOR "NAME_TEMPLATES"
DESCRIPTION "Monitors for contents of error "
INTERVAL "1m"
MONPROG "script.sh NAME_TEMPLATES"
MAXTHRESHOLD
GEN_BELOW_RESET
SEVERITY Major
... (17 Replies)
Discussion started by: Ant-one
17 Replies
9. UNIX for Dummies Questions & Answers
Hello !
I am very aware that this is not the first time this question is asked here, because I have already read a lot of previous answers, but none of them worked, so...
As said in the title, I want to read a csv file with a bash script.
Here is a sample of the file:
... (4 Replies)
Discussion started by: Grhyll
4 Replies
10. Shell Programming and Scripting
My source file looks like this:
Cust-Number = "101"
Cust-Name="Joe"
Cust-Town="London"
Cust-hobby="tennis"
Cust-purchase="200"
Cust-Number = "102"
Cust-Name="Mary"
Cust-Town="Newyork"
Cust-hobby="reading"
Cust-purchase="125"
Now I want to parse this file (leaving out hobby) and... (10 Replies)
Discussion started by: Balav
10 Replies
LEARN ABOUT DEBIAN
business::paypal::api::reauthorizationrequest
Business::PayPal::API::ReauthorizationRequest(3pm) User Contributed Perl Documentation Business::PayPal::API::ReauthorizationRequest(3pm)
NAME
Business::PayPal::API::ReauthorizationRequest - PayPal ReauthorizationRequest API
SYNOPSIS
use Business::PayPal::API::ReauthorizationRequest;
## see Business::PayPal::API documentation for parameters
my $pp = new Business::PayPal::API::ReauthorizationRequest ( ... );
my %response = $pp->DoReauthorizationRequest (
AuthorizationID => $transid,
Amount => $amount,
CurrencyID => $currencyID
);
DESCRIPTION
Business::PayPal::API::ReauthorizationRequest implements PayPal's DoReauthorizationRequest API using SOAP::Lite to make direct API calls to
PayPal's SOAP API server. It also implements support for testing via PayPal's sandbox. Please see Business::PayPal::API for details on
using the PayPal sandbox.
DoReauthorizationRequest
Implements PayPal's DoReauthorizationRequest API call. Supported parameters include:
AuthorizationID
Amount
currencyID (defaults to 'USD' if not supplied)
as described in the PayPal "Web Services API Reference" document. The default currencyID setting is 'USD' if not otherwise specified. The
DoReauthorization is not allowed before the three day grace period set for the original AuthorizeRequest.
Returns a hash containing the results of the transaction.
Example:
my %resp = $pp->DoReauthorizationRequest (
AuthorizationID => $trans_id,
Amount => '15.00',
CurrencyID => 'USD'
);
unless( $resp{Ack} !~ /Success/ ) {
for my $error ( @{$response{Errors}} ) {
warn "Error: " . $error->{LongMessage} . "
";
}
}
ERROR HANDLING
See the ERROR HANDLING section of Business::PayPal::API for information on handling errors.
EXPORT
None by default.
SEE ALSO
<https://developer.paypal.com/en_US/pdf/PP_APIReference.pdf>
AUTHOR
Danny Hembree <danny@dynamical.org>
COPYRIGHT AND LICENSE
Copyright (C) 2006 by Danny Hembree
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.5 or,
at your option, any later version of Perl 5 you may have available.
perl v5.14.2 2009-12-07 Business::PayPal::API::ReauthorizationRequest(3pm)