Sponsored Content
Top Forums Shell Programming and Scripting Adding column values in a file Post 302754875 by Scrutinizer on Friday 11th of January 2013 10:24:18 AM
Old 01-11-2013
A simpler version without adaptive column widths:
Code:
awk '
  $1=="for"{
    A[I=$2]
    next
  } 
  NF{
    if($1 in A){
      sub(ORS, T[$1]+$2 ORS, A[$1])
      printf "%s",$1 A[$1]
    } 
    else {
      A[I]=sprintf("%s\t%s\t%-11s\n",A[I],$1,$2)
      T[I]+=$2
    }
  }
' infile

This User Gave Thanks to Scrutinizer For This Post:
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help in adding positive & negative values in a column

Hi Gurus, In my file I have an amount field from position 74 to 87, which contains values starting with '+' as well as '-'. I want to add all positive values in a varible called "CREDIT" and all negative values in a variable "DEBIT". I know, we can use grep to identify values with positive and... (4 Replies)
Discussion started by: berlin_germany
4 Replies

2. Shell Programming and Scripting

How to check Null values in a file column by column if columns are Not NULLs

Hi All, I have a table with 10 columns. Some columns(2nd,4th,5th,7th,8th and 10th) are Not Null columns. I'll get a tab-delimited file and want to check col by col and generate seperate error code for each col eg:102 if 2nd col value is NULL and 104 if 4th col value is NULL so on... I am a... (7 Replies)
Discussion started by: Mandab
7 Replies

3. Shell Programming and Scripting

Adding the values of two file

I have two files as Count1 and Count2. The count contains only one values as 10 and count2 contains only one values as 20. Now I want third file Count3 as count1+Count2. That is it should contain sum of two file(10+20=30) (3 Replies)
Discussion started by: Shell_Learner
3 Replies

4. Shell Programming and Scripting

problem while adding column values in awk

Hi, I have a file "input.txt" with the following content : 5312,0,,,1,8,141.2,20090727 3714,0,,,1,8,285.87,20090727 5426,0,,,1,8,3.9,20090727 3871,0,,,1,8,30.4,20090727 9071,0,,,1,8,146.2,20090727 5141,0,,,1,8,2.8,20090727 0460,0,,,1,8,-0.1,20090727 7918,0,,,1,8,-0.1,20090727... (3 Replies)
Discussion started by: valokv
3 Replies

5. UNIX for Dummies Questions & Answers

Adding column with values

Dear all, I need your help for my question please I have without header (space separated) and need to add two colomns at the beginning with values my file look like : rs1 a t 0.6 rs2 a c 0.3 rs3 t g 0.8 I need to a new file like: 1 100 rs1 a t 0.6 1 100 rs2 a c 0.3 1 100 rs3 t g... (3 Replies)
Discussion started by: biopsy
3 Replies

6. Shell Programming and Scripting

Adding Column Values Using Pattern Match

Hi All, I have a file with data as below: A,FILE1_MYFILE_20130309_1038,80,25.60 B,FILE1_MYFILE_20130309_1038,24290,18543.38 C,FILE1_dsc_dlk_MYFILE_20130309_1038,3,10.10 A,FILE2_MYFILE_20130310_1039,85,110.10 B,FILE2_MYFILE_20130310_1039,10,12.10... (10 Replies)
Discussion started by: angshuman
10 Replies

7. Shell Programming and Scripting

Adding of two column values

Hi cat /tmp/xx.txt 1 4 1 5 1 6 2 1 2 1 2 1 i want to add the values of 2nd column resepect to 1st column values..for 1 in 1st column i need sum of all the values in 2nd column ..pls tell me hw to do it?? (8 Replies)
Discussion started by: Aditya.Gurgaon
8 Replies

8. Shell Programming and Scripting

Adding values of a column based on another column

Hello, I have a data such as this: ENSGALG00000000189 329 G A 4 2 0 ENSGALG00000000189 518 T C 5 1 0 ENSGALG00000000189 1104 G A 5 1 0 ENSGALG00000000187 3687 G T 5 1 0 ENSGALG00000000187 4533 A T 4 2 0 ENSGALG00000000233 5811 T C 4 2 0 ENSGALG00000000233 5998 C A 5 1 0 I want to... (3 Replies)
Discussion started by: Homa
3 Replies

9. Shell Programming and Scripting

Remove the values from a certain column without deleting the Column name in a .CSV file

(14 Replies)
Discussion started by: dhruuv369
14 Replies
Vend::Payment::AuthorizeNet(3pm)			User Contributed Perl Documentation			  Vend::Payment::AuthorizeNet(3pm)

NAME
Vend::Payment::AuthorizeNet - Interchange AuthorizeNet Support SYNOPSIS
&charge=authorizenet or [charge mode=authorizenet param1=value1 param2=value2] PREREQUISITES
Net::SSLeay or LWP::UserAgent and Crypt::SSLeay Only one of these need be present and working. DESCRIPTION
The Vend::Payment::AuthorizeNet module implements the authorizenet() routine for use with Interchange. It is compatible on a call level with the other Interchange payment modules. To enable this module, place this directive in "interchange.cfg": Require module Vend::Payment::AuthorizeNet This must be in interchange.cfg or a file included from it. Make sure CreditCardAuto is off (default in Interchange demos). The mode can be named anything, but the "gateway" parameter must be set to "authorizenet". To make it the default payment gateway for all credit card transactions in a specific catalog, you can set in "catalog.cfg": Variable MV_PAYMENT_MODE authorizenet It uses several of the standard settings from Interchange payment. Any time we speak of a setting, it is obtained either first from the tag/call options, then from an Interchange order Route named for the mode, then finally a default global payment variable, For example, the "id" parameter would be specified by: [charge mode=authorizenet id=YourAuthorizeNetID] or Route authorizenet id YourAuthorizeNetID or Variable MV_PAYMENT_ID YourAuthorizeNetID The active settings are: id Your Authorize.net account ID, supplied by Authorize.net when you sign up. Global parameter is MV_PAYMENT_ID. secret Your Authorize.net account password, supplied by Authorize.net when you sign up. Global parameter is MV_PAYMENT_SECRET. This may not be needed for actual charges. referer A valid referering url (match this with your setting on secure.authorize.net). Global parameter is MV_PAYMENT_REFERER. transaction The type of transaction to be run. Valid values are: Interchange AuthorizeNet ---------------- ----------------- auth AUTH_ONLY return CREDIT reverse PRIOR_AUTH_CAPTURE sale AUTH_CAPTURE settle CAPTURE_ONLY void VOID remap This remaps the form variable names to the ones needed by Authorize.net. See the "Payment Settings" heading in the Interchange documentation for use. test Set this to "TRUE" if you wish to operate in test mode, i.e. set the Authorize.net "x_Test_Request" query parameter to TRUE. Examples: Route authorizenet test TRUE or Variable MV_PAYMENT_TEST TRUE or [charge mode=authorizenet test=TRUE] Troubleshooting Try the instructions above, then enable test mode. A test order should complete. Disable test mode, then test in various Authorize.net error modes by using the credit card number 4222 2222 2222 2222. Then try a sale with the card number "4111 1111 1111 1111" and a valid expiration date. The sale should be denied, and the reason should be in [data session payment_error]. If nothing works: o Make sure you "Require"d the module in interchange.cfg: Require module Vend::Payment::AuthorizeNet o Make sure either Net::SSLeay or Crypt::SSLeay and LWP::UserAgent are installed and working. You can test to see whether your Perl thinks they are: perl -MNet::SSLeay -e 'print "It works "' or perl -MLWP::UserAgent -MCrypt::SSLeay -e 'print "It works "' If either one prints "It works." and returns to the prompt you should be OK (presuming they are in working order otherwise). o Check the error logs, both catalog and global. o Make sure you set your payment parameters properly. o Try an order, then put this code in a page: <XMP> [calc] my $string = $Tag->uneval( { ref => $Session->{payment_result} }); $string =~ s/{/{ /; $string =~ s/,/, /g; return $string; [/calc] </XMP> That should show what happened. o If all else fails, consultants are available to help with integration for a fee. See http://www.icdevgroup.org/ for mailing lists and other information. BUGS
There is actually nothing *in* Vend::Payment::AuthorizeNet. It changes packages to Vend::Payment and places things there. AUTHORS
Mark Stosberg <mark@summersault.com>. Based on original code by Mike Heins <mike@perusion.com>. CREDITS
Jeff Nappi <brage@cyberhighway.net> Paul Delys <paul@gi.alaska.edu> webmaster@nameastar.net Ray Desjardins <ray@dfwmicrotech.com> Nelson H. Ferrari <nferrari@ccsc.com> perl v5.14.2 2011-05-02 Vend::Payment::AuthorizeNet(3pm)
All times are GMT -4. The time now is 08:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy