Sponsored Content
Top Forums Shell Programming and Scripting way to print all the string till we get a space and a number Post 302278387 by villain41 on Tuesday 20th of January 2009 05:29:59 AM
Old 01-20-2009
vi file.sh ==>

while IFS= read str
do
col1=${str/*([[:print:]])([[:space:]])+([[:digit:]])/\1}
col2=${str/*([[:print:]])([[:space:]])+([[:digit:]])/\3}
printf "COL1: ${col1} COL2: ${col2}\n"
done < input

vi input==>

0 892
SetExpressCheckout 4
DoExpressCheckout Payment 4
0-211 3
GetExpressCheckoutDetails 4
3.auth error.INTERNAL.5005 1
2.NVPPAYMENTSERV INTERNAL 0(10002) 1
2.NVPPAYMENTSERV INTERNAL.5005 1

now ./file.sh ==>

COL1: 0 892 COL2: 0 892
COL1: SetExpressCheckout 4 COL2: SetExpressCheckout 4
COL1: DoExpressCheckout Payment 4 COL2: DoExpressCheckout Payment 4
COL1: 0-211 3 COL2: 0-211 3
COL1: GetExpressCheckoutDetails 4 COL2: GetExpressCheckoutDetails 4
COL1: 3.auth error.INTERNAL.5005 1 COL2: 3.auth error.INTERNAL.5005 1
COL1: 2.NVPPAYMENTSERV INTERNAL 0(10002) 1 COL2: 2.NVPPAYMENTSERV INTERNAL 0(10002) 1
COL1: 2.NVPPAYMENTSERV INTERNAL.5005 1 COL2: 2.NVPPAYMENTSERV INTERNAL.5005 1

:confused: plz tell me what is wrong with the code.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to print lines till till a pattern is matched in loop

Dear All I have a file like this 112534554 446538656 444695656 225696966 226569744 228787874 113536566 443533535 222564552 115464656 225445345 225533234 I want to cut the file into different parts where the first two columns are '11' . The first two columns will be either... (3 Replies)
Discussion started by: anoopvraj
3 Replies

2. Shell Programming and Scripting

How to print the number of lines from a file, the starting string should be passed`

Hi , I have file, which has the below content: line 100 a b c d line300 a s d f s line200 a s d a (3 Replies)
Discussion started by: little_wonder
3 Replies

3. Shell Programming and Scripting

awk or sed command to print specific string between word and blank space

My source is on each line 98.194.245.255 - - "GET /disp0201.php?poc=4060&roc=1&ps=R&ooc=13&mjv=6&mov=5&rel=5&bod=155&oxi=2&omj=5&ozn=1&dav=20&cd=&daz=&drc=&mo=&sid=&lang=EN&loc=JPN HTTP/1.1" 302 - "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.0.3705; .NET CLR... (5 Replies)
Discussion started by: elamurugu
5 Replies

4. Shell Programming and Scripting

Remove line starting from space till end.

Hi, I have a code tag, from which i have the below snippet: intelrpt.GetCMB_FB type=ODBC> intelrpt.GetCMB_FB type=SYBASE> I want the output like: intelrpt.GetCMB_FB intelrpt.GetCMB_FB That is remove the lines starting from WHITESPACE till end. Please help. I am new to... (7 Replies)
Discussion started by: anupdas
7 Replies

5. Shell Programming and Scripting

Bash take word after specific point and till next space?

Hello, I have an output like Interface Chipset Driver wlan0 Intel 4965/5xxx iwlagn - and I want to take only the 'wlan0' string. This can be done by a="Interface Chipset Driver wlan0 Intel 4965/5xxx iwlagn - " b=${a:25:6} echo $bThe thing is that wlan0 can be something else, like eth0 or... (2 Replies)
Discussion started by: hakermania
2 Replies

6. Programming

Find and print number after string in C

I'm trying find and print a number after a specific user passed string in each line of a text file using C (as requested by the powers that be). I've pieced together enough to read the file, find the string and print the line it was found on but I’m not sure where to even start in terms of finding... (3 Replies)
Discussion started by: cgol
3 Replies

7. Shell Programming and Scripting

find string nth occurrence in file and print line number

Hi I have requirement to find nth occurrence in a file and capture data from with in lines (between lines) Data in File. <QUOTE> <SESSION> <ATTRIBUTE NAME='Parameter Filename' VALUE='file1.parm'/> <ATTRIBUTE NAME='Service Name' VALUE='None'/> </SESSION> <SESSION> <ATTRIBUTE... (6 Replies)
Discussion started by: tmalik79
6 Replies

8. Shell Programming and Scripting

Print characters till the next space when the pattern is found

i have a file which contains alphanumeric data in every line. what i need is the data after certain pattern. the data after the pattern is not of fixed length so i need the data till the space after the pattern. Input file: bfdkasfbdfg khffkf lkdhfhdf pattern (datarequired data not required)... (2 Replies)
Discussion started by: gpk_newbie
2 Replies

9. Shell Programming and Scripting

Adding variable number of space in between two string

Hi, I am looking for the way to add variable number of spaces between two string. e.g input line is a ,bb abc ,bcb pqr ,bfg My output should be something like this a ,bb abc ,bcb pqr ,bfg This text... (9 Replies)
Discussion started by: diehard
9 Replies

10. Shell Programming and Scripting

Print String N times the number before it

Hey All, I want want to print a string N times the number N before it. Like i have "20 hello". so i want to print hello hello hello . . . . . 20 times.. Please help me.. I am not able o figure out.. how to do the same? (8 Replies)
Discussion started by: jaituteja
8 Replies
Business::PayPal::API::ExpressCheckout(3pm)		User Contributed Perl Documentation	       Business::PayPal::API::ExpressCheckout(3pm)

NAME
Business::PayPal::API::ExpressCheckout - PayPal Express Checkout API SYNOPSIS
use Business::PayPal::API::ExpressCheckout; ## see Business::PayPal::API documentation for parameters my $pp = new Business::PayPal::API::ExpressCheckout ( ... ); my %resp = $pp->SetExpressCheckout ( OrderTotal => '55.43', ## defaults to USD ReturnURL => 'http://site.tld/return.html', CancelURL => 'http://site.tld/canceltation.html', ); ... time passes, buyer validates the token with PayPal ... my %details = $pp->GetExpressCheckoutDetails($resp{Token}); ## now ask PayPal to xfer the money my %payinfo = $pp->DoExpressCheckoutPayment( Token => $details{Token}, PaymentAction => 'Sale', PayerID => $details{PayerID}, OrderTotal => '55.43' ); DESCRIPTION
Business::PayPal::API::ExpressCheckout implements PayPal's Express Checkout 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. SetExpressCheckout Implements PayPal's "Website Payment Pro" SetExpressCheckout API call. Supported parameters include: Token OrderTotal currencyID MaxAmount OrderDescription Custom InvoiceID ReturnURL CancelURL Address ReqConfirmShipping NoShipping AddressOverride LocaleCode PageStyle 'cpp-header-image' 'cpp-header-border-color' 'cpp-header-back-color' 'cpp-payflow-color' PaymentAction BuyerEmail BillingType BillingAgreementDescription PaymentType BillingAgreementCustom as described in the PayPal "Web Services API Reference" document. The default currency setting is 'USD' if not otherwise specified. Returns a hash containing a 'Token' key, whose value represents the PayPal transaction token. Required fields: OrderTotal, ReturnURL, CancelURL. my %resp = $pp->SetExpressCheckout(); my $token = $resp{Token}; Example (courtesy Ollie Ready): my $address = { Name => 'Some Customer', Street1 => '888 Test St.', Street2 => 'Suite 9', CityName => 'San Diego', StateOrProvince => 'CA', PostalCode => '92111', Country => 'US', Phone => '123-123-1234', }; my %response = $pp->SetExpressCheckout( OrderTotal => '11.01', ReturnURL => '<![CDATA[http://example.com/p?cmd=checkout]]>', CancelURL => 'http://example.com', PaymentAction => 'Authorization', AddressOverride => 1, Address => $address, ); GetExpressCheckoutDetails Implements PayPal's WPP SetExpressCheckout API call. Supported parameters include: Token as described in the PayPal "Web Services API Reference" document. This is the same token you received from SetExpressCheckout. Returns a hash with the following keys: Token Custom InvoiceID ContactPhone Payer PayerID PayerStatus FirstName LastName PayerBusiness AddressStatus Name Street1 Street2 CityName StateOrProvince PostalCode Country Required fields: Token DoExpressCheckoutPayment Implements PayPal's WPP SetExpressCheckout API call. Supported parameters include: Token PaymentAction (defaults to 'Sale' if not supplied) PayerID currencyID (defaults to 'USD' if not supplied) OrderTotal OrderDescription ItemTotal ShippingTotal HandlingTotal TaxTotal Custom InvoiceID ButtonSource NotifyURL ST_Name ST_Street1 ST_Street2 ST_CityName ST_StateOrProvince ST_Country ST_PostalCode PDI_Name PDI_Amount PDI_Number PDI_Quantity PDI_Tax as described in the PayPal "Web Services API Reference" document. Returns a hash with the following keys: Token TransactionID TransactionType PaymentType PaymentDate GrossAmount FeeAmount SettleAmount TaxAmount ExchangeRate PaymentStatus PendingReason BillingAgreementID (if BillingType 'MerchantInitiatedBilling' was specified during SetExpressCheckout) Required fields: Token, PayerID, OrderTotal ERROR HANDLING See the ERROR HANDLING section of Business::PayPal::API for information on handling errors. EXAMPLES
Andy Spiegl <paypalcheckout.Spiegl@kascada.com> has kindly donated some example code (in German) which may be found in the eg directory of this archive. Additional code examples may be found in the t test directory. EXPORT None by default. SEE ALSO
SOAP::Lite, Business::PayPal::API, <https://www.paypal.com/IntegrationCenter/ic_expresscheckout.html>, <https://developer.paypal.com/en_US/pdf/PP_APIReference.pdf> AUTHOR
Scott Wiersdorf, <scott@perlcode.org> COPYRIGHT AND LICENSE
Copyright (C) 2006 by Scott Wiersdorf 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.6 or, at your option, any later version of Perl 5 you may have available. perl v5.14.2 2009-12-07 Business::PayPal::API::ExpressCheckout(3pm)
All times are GMT -4. The time now is 04:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy