Sponsored Content
Full Discussion: lookup table in perl??
Top Forums Shell Programming and Scripting lookup table in perl?? Post 302094917 by Bhups on Thursday 2nd of November 2006 02:55:47 AM
Old 11-02-2006
lookup table in perl??

hi,

i am very much new in perl and have this very basic question in the sameSmilie

the requirement is as below:

i have an input file (txt file) in which i have fields invoice number and customer number. Now i have to take input this combination of invoice n customer number and check in a lookup file (pipe delimited txt file) and if the combination exists, then i have to get the new invoice number (present in lookup table) and append this new invoice number into the original record of the input file.

for example:

input file record: aaabbbinvoicenum1customernum1333

lookup record:11111invoicenum1customernum18888newinvoicenum1


so now original input record becomes:

aaabbbinvoicenum1customernum1333newinvoicenum1

i have to use hash array here in perl with keys as invoice and customer number combination, but me not sure how to use itSmilie..

please help me out in solving this...

regards,
Bhups
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

HELP with using a lookup table

Using AIX 5.2, Bourne and Korn Shell. I have two flat text files. One is a main file and one is a lookup table that contains a number of letter codes and membership numbers as follows: 316707965EGM01 315672908ANM92 Whenever one of these records from the lookup appears in the main file... (6 Replies)
Discussion started by: Dolph
6 Replies

2. UNIX for Advanced & Expert Users

Clueless about how to lookup and reverse lookup IP addresses under a file!!.pls help

Write a quick shell snippet to find all of the IPV4 IP addresses in any and all of the files under /var/lib/output/*, ignoring whatever else may be in those files. Perform a reverse lookup on each, and format the output neatly, like "IP=192.168.0.1, ... (0 Replies)
Discussion started by: choco4202002
0 Replies

3. Shell Programming and Scripting

Search, replace string in file1 with string from (lookup table) file2?

Hello: I have another question. Please consider the following two sample, tab-delimited files: File_1: Abf1 YKL112w Abf1 YAL054c Abf1 YGL234w Ace2 YKL150w Ace2 YNL328c Cup9 YDR441c Cup9 YDR442w Cup9 YEL040w ... File 2: ... ABF1 YKL112W ACE2 YLR131C (9 Replies)
Discussion started by: gstuart
9 Replies

4. Programming

64-bit CRC Transition To Bytewise Lookup-Table

Good Evening, I started working on the 17x17 4-colouring challenge, and I ran into a bit of an I/O snag. It was an enormous headache to detect the differences in very similar 289-char strings. Eventually, it made more sense to associate a CRC-Digest with each colouring. After learning... (0 Replies)
Discussion started by: HeavyJ
0 Replies

5. Shell Programming and Scripting

Sed variable from lookup table

I have a file with the following format --TABLEA_START-- field1=data1;field2=data2;field3=data3 --TABLEA_END-- --TABLEB_START-- field1=data1;field2=data2;field3=data3 --TABLEB_END-- --TABLEA_START-- field1=data1;field2=data2;field3=data3 ... (0 Replies)
Discussion started by: milo7
0 Replies

6. UNIX for Dummies Questions & Answers

string replacement using a lookup table

Dear all thanks for helping in advance.. Know this should be fairly simple but I failed in searching for an answer. I have a file (replacement table) containing two columns, e.g.: ACICJ ACIDIPHILIUM ACIF2 ACIDITHIOBACILLUS ACIF5 ACIDITHIOBACILLUS ACIC5 ACIDOBACTERIUM ACIC1 ACIDOTHERMUS... (10 Replies)
Discussion started by: roussine
10 Replies

7. Shell Programming and Scripting

Perform Lookup File In Perl From One input File

Hi Perl Guru, I'm new to Perl Programming & need some help. I need to have some kind of similar code template so I can start to work on it. I'm been reading some forums and did not find anything that are similar so I start to work on it. I've been struggling on how to start it. Any... (1 Reply)
Discussion started by: devvvt168
1 Replies

8. Shell Programming and Scripting

Perl value lookup and replace

Hi, I have an input file and a config file which I need to lookup values in using Perl: Input file: ID, Value COMP0,0 COMP1,1 COMP2,2 COMP3,3 COMP4,3 COMP5,5Config file: ID, Operation COMP0,((@COMP1@ + @COMP2@ + @COMP3@) / @COMP4@) + @COMP5@Expected output: ID, Value COMP0,7 # This... (0 Replies)
Discussion started by: Subbeh
0 Replies

9. Shell Programming and Scripting

Filtering duplicates based on lookup table and rules

please help solving the following. I have access to redhat linux cluster having 32gigs of ram. I have duplicate ids for variable names, in the file 1,2 are duplicates;3,4 and 5 are duplicates;6 and 7 are duplicates. My objective is to use only the first occurrence of these duplicates. Lookup... (4 Replies)
Discussion started by: ritakadm
4 Replies

10. Shell Programming and Scripting

Korn shell - lookup table

Hi All I need to pass country code into a pipe delimited file for lookup. It will search country code (column 3) in the file, if the country code matched, it will return value from other columns. Here is my mapping file. #CountryName|CountryRegion|CountryCode-3|CountryCode-2... (5 Replies)
Discussion started by: lafrance
5 Replies
LedgerSMB::DBObject::Company(3pm)			User Contributed Perl Documentation			 LedgerSMB::DBObject::Company(3pm)

NAME
LedgerSMB::DBObject::Company - Base utility functions for processing customers and vendors. SYNOPSIS
This library contains the base utility functions for creating, saving, and retrieving customers and vendors. METHODS
$company->set_entity_class() This is a stub for a private method that subclasses are expected to overwrite. It will be set to the account class of the entity (1 for vendor, 2 for customer, etc). get_by_cc This retrieves the company header information by control code. Leaves the overall account class untouched. save() This stores the company record including a credit account in the database. TODO: Separate company from credit account storage. delete_contact required request variables: contact_class_id: int id of contact class contact: text of contact information Must include at least one of: credit_id: int of entity_credit_account.id, preferred value company_id: int of company.id, only used if credit_id not set. returns true of a record was deleted. delete_location Deletes a record from the location side. Required request variables: location_id location_class_id One of: credit_id (preferred) company_id (as fallback) Returns true if a record was deleted. False otherwise. delete_bank_account Deletes a bank account Requires: entity_id bank_account_id Returns true if a record was deleted, false otherwise. get_history Retrieves customer/vendor purchase. Search Criteria name: search string for company name contact_info: Search string for contact info, can match phone, fax, or email. salesperson: Search string for employee name in the salesperson field notes: Notes search. Not currently implemented meta_number: Exact match for customer/vendor number address_line: Search string for first or second line of address. city: Search string for city name state: Case insensitive, otherwise exact match for state or province zip: leading match for zip/mail code country_id: integer for country id. Exact match tartdate_from: Earliest date for startdate of entity credit account startdate_to: Lates date for entity credit accounts' start date type: either 'i' for invoice, 'o' for orders, 'q' for quotations from_date: Earliest date for the invoice/order to_date: Latest date for the invoice/order Unless otherwise noted, partial matches are sufficient. Control variables: inc_open: Include open invoices/orders. If not true, no open invoices are displayed inc_closed: Include closed invoices/orders. If not true, no closed invoices are displayed report_type: Either summary or detail returns a list of rows of the summary report and sets these to @{$self->{history_rows}} save_credit This method saves the credit account for the company. Expected inputs: credit_id (int): (Optional) Id for the account entity_class (int): Class of the account, required (1 = vendor, 2 = customer) entity_id (int): ID of entity to attach to. description (text): Description of account discount (numeric): Early payment discount taxincluded (bool): Whether prices include tax. creditlimit (numeric): Credit limit discount_terms (int): How many days can elapse before the discount lapses too. terms (int): How many days can lapse before the invoice is overdue. meta_number (varchar): Account string identifier for the account. business_id (int): ID for business type. language (varchar): Language code for invoices. pricegroup_id (int): Price group curr (char): Currency identifier, three characters long. startdate (date): Date of the start of the relationship. enddate (date): Date of the end of the relationship. threshold (NUMERIC): How much must be owed before the invoices can be paid. ar_ap_account_id (int): ID of ar/ap account. REQUIRED cash_account_id (int): ID of cash account (Optional) pay_to_name (text): Name to pay to or receive from. taxform_id (int); ID of tax form save_location This method saves an address for a company. Requires the following variables on the object: credit_id location_id location_class (1 = billing, 2 = shipping, 3 = sales) line_one line_two city state (can hold province info) mail_code (zip or postal code) country_code (ID of country) get_credit_id This method returns the current credit id from the screen. Requires entity_id, meta_number, and entity_class be set. get_metadata() This retrieves various information vor building the user interface. Among other things, it sets the following properties: $self->{ar_ap_acc_list} = qw(list of ar or ap accounts) $self->{cash_acc_list} = qw(list of cash accounts) $self->{entity_classes} = qw(list of entity classes) $self->{all_taxes} =qw(list of taxes) save_contact Saves a contact. Requires credit_id, contact_class, description, and contact to be set. Requires the following be set: credit_id or entity_id contact_class description contact old_contact old_contact_class save_bank_account Saves a bank account. Requires the following be set: entity_id bic (bank id) iban (account number) bank_account_id (id for record, optional) save_notes Saves notes. The following must be set: credit_id: credit account to annotate. Must be set to annotate credit account entity_id: entitity to annotate. note: Note contents subject: Note subject search Searches for matching company records. Populates $self->{search_results} with records found. Search criteria and inputs: account_class: required (1 for vendor, 2 for customer, etc) contact contact_info meta_number address city state mail_code country date_from date_to business_id legal_name control_code Account class may not be undef. meta_number is an exact match, as is control_code. All others specify ranges or partial matches. get_billing_info Requires that the id field is set. Sets the following: legal_name meta_number control_code tax_id street1 street2 street3 city state mail_code country accounts Returns all accounts, and sets these to $self->{accounts}. id and entity_class must be set. address($id) Returns the location if it is specified by the $id argument. get Retrieves a company record and all info. taxform_list is set to a list of tax forms for the entity's country credit_list is set to a list of credit accounts locations is set to a list of locations contacts to a list of contacts notes to a list of notes bank_account to a list of bank accounts get_pricematrix This routine gets the price matrix for the customer or vendor. The pricematrix info is stored in the pricematrix hash entry. If a customer (account_class=1), it also populates a pricematrix_pricegroup entry. delete_pricematrix($entry_id) This deletes a pricematrix line identified by $entry_id save_pricematrix Updates or inserts the price matrix. COPYRIGHT
Copyright (c) 2009, the LedgerSMB Core Team. This is licensed under the GNU General Public License, version 2, or at your option any later version. Please see the accompanying License.txt for more information. perl v5.14.2 2012-03-25 LedgerSMB::DBObject::Company(3pm)
All times are GMT -4. The time now is 01:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy