Sponsored Content
Top Forums Shell Programming and Scripting awk NR==FNR compare 2 files produce a 3rd Post 302298392 by borderblaster on Tuesday 17th of March 2009 11:44:36 AM
Old 03-17-2009
franklin, ive realised i need to compare two columns, i.e. if both customer id and account id match in both files then append packageid to the end of the relevent line in the first file. Can that be done?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Awk: different between NR and FNR

As I know: FNR: The ordinal number of the current record in the current file. NR: The ordinal number of the current record from the start of input. I don't understand really differency between NR and FNR. Who can explain it for me? And give me an example. Thanks (1 Reply)
Discussion started by: anhtt
1 Replies

2. Shell Programming and Scripting

Shell script that will compare two config files and produce 2 outputs 1)actual config file 2)report

Hi I am new to shell scripting. There is a requirement to write a shell script to meet follwing needs.Prompt reply shall be highly appreciated. script that will compare two config files and produce 2 outputs - actual config file and a report indicating changes made. OS :Susi linux ver 10.3. ... (4 Replies)
Discussion started by: muraliinfy04
4 Replies

3. UNIX for Dummies Questions & Answers

awk NR==FNR output control

Hi Guys, I have two files: f1: A B C D E F G H f2: A X Y Z f1 has 48000 lines, and f2 has 68. I have been matching f1 $3 to f2 $1, and getting f3: A A B C D E F G I would like f3 too look like this: A X Y Z A B C D E F G (2 Replies)
Discussion started by: heecha
2 Replies

4. Shell Programming and Scripting

Awk FNR==NR question

awk -F'' 'FNR==NR {a=$2; next} {$1=a} 1' $useralias ${entries} >> ${entries}_2 Hi, Is there anyway to alter this command so that if it does not find a match it will just leave the line alone instead of replacing what it doesn't find with a blank space? (4 Replies)
Discussion started by: Jazmania
4 Replies

5. Shell Programming and Scripting

awk to compare 2nd and 3rd field and print the differences

need a one liner to compare 2nd and 3rd field and print values that are not matched in 2nd field Input col 2 col 3 1.1.1.1 11.11.11.11 8.8.8.8 0.0.0.0 3.3.3.3 2.2.2.2 7.7.7.7 3.3.3.3 5.5.5.5 1.1.1.1 4.4.4.4 6.6.6.6 9.9.9.9 output 7.7.7.7 ... (12 Replies)
Discussion started by: chidori
12 Replies

6. Shell Programming and Scripting

Compare 3rd column in 2 files

I have the following 2 files. File 1 08FB,000192602673,10000000c9a6b240 0121,000192602673,20000025b550101f 0121,000192602673,20000025b550100f 08FA,000192602673,10000000c9a6b240 File 2 18F2,000195702363,10000000c9a6b240 18F3,000195702363,10000000c9a6b240... (2 Replies)
Discussion started by: kieranfoley
2 Replies

7. Shell Programming and Scripting

Tip: alternative for NR==FNR in awk

Example: $ cat file1 2 3$ cat file2 1 2 3 4 5 6The following awk script works like a charm, NR==FNR is true for file1, the remainder runs for file2: awk ' NR==FNR {A; next} ($1 in A) ' file1 file2 2 3Now have an empty file1: >file1and run the awk script again. The result is empty... (8 Replies)
Discussion started by: MadeInGermany
8 Replies

8. Shell Programming and Scripting

awk --> selective printout with FNR

Hi everybody! need some awk-support. i want a line-selective printout of a file. wat i normally will do with ... awk ' FNR==8' sample.txt But now i need the data from line 8, 10 and the following data from line13 to 250 wich is not end of the file. I tried allready to combine it but without... (2 Replies)
Discussion started by: IMPe
2 Replies

9. Shell Programming and Scripting

Explanation of FNR in this awk script

To merge mutiple *.tab files as: file1.tab rs1 A A rs2 A A rs3 C C rs4 C Cfile2.ind rs1 T T rs2 T T rs3 G G rs4 G Gand file3.tab rs1 B B rs2 B B rs3 L L rs4 L LOutput: file1.tab file2.tab file3.tab AA TT BB AA TT BB CC GG LL CC GG ... (4 Replies)
Discussion started by: yifangt
4 Replies

10. Shell Programming and Scripting

Awk: Assigning a variable to be the value of FNR at a certain line

Sorry for the probably strangely worded title but I don't really know how else to put it. Background context: Post processing LAMMPS simulation data. tl;dr: I'm making two spheres collide, every defined timestep the simulation outputs a bunch of data including total energy of the particles,... (10 Replies)
Discussion started by: ThomasP
10 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 04:18 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy