Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Need tips on file manipulation Post 302365273 by thegeek on Monday 26th of October 2009 01:38:35 PM
Old 10-26-2009
Code:
while(<>)  {
    if ( /^\d{8}$/ )  {
        close FH;
        $filename = $_;
        open FH, ">$filename";
    }  else  {
        print FH "$_";
    }
}

It will work, but this is not an efficient or standard way to do things.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

File manipulation

I'm new to Unix and want to know if this type of file processing is feasible. I have a master file downloaded on Sundays. From Monday to Saturday a file containing changes and adds and a file containing deletes are downloaded. I'd like to apply the mon-sat files to the master file so that I do not... (3 Replies)
Discussion started by: ssp7423
3 Replies

2. Shell Programming and Scripting

File manipulation

To all Guru I have a file like test.txt 111,122,212,123 data11,date12, data13, data14...data1n data21,date22, data23, data24...data2n data31,date32, data33, data34...data3n ... ... .. datan1,daten2, datan3, datan4...datann END I have to load this data into oracle , where first... (1 Reply)
Discussion started by: u263066
1 Replies

3. Shell Programming and Scripting

file manipulation

Hi, I have a file with 3 lines like aaaabb abcdef wertyu now i want to insert a new character "Q" in the 3rd position of every line of the file.... I found a way to do it but i felt it is little complex. Do you guys have any ideas (4 Replies)
Discussion started by: siddu_chittari
4 Replies

4. Shell Programming and Scripting

File Manipulation

Hi, i have a file with fixed record length with the following content (only one sentence) 12345678901234567890123456789012345678901234567890 12345678 87654321 hugo meyer friedhofpaul the numbers above are only the column-positions and not part of the file! Now i want... (2 Replies)
Discussion started by: FranzB
2 Replies

5. Shell Programming and Scripting

File manipulation

Hello, I have a file of which six lines are given below: <a="b" value="N"/> <a="c" value="x1"/> <a="b" value="N"/> <a="c" value="x2"/> <a="b" value="Y"/> <a="c" value="x3"/> I need one file with all the lines just below where value="N"... (4 Replies)
Discussion started by: shekhar2010us
4 Replies

6. UNIX for Dummies Questions & Answers

file manipulation

Is there a way to cp/mv a set of files in a directory + sub directories without cp/mv'ing the sub-directories as well? eg. To copy all the *.pdf files in a directory + sub directory into a specified folder i would invoke " cp -R *.pdf ~/Home/ however, this would copy the subdirectories as... (4 Replies)
Discussion started by: grkness
4 Replies

7. UNIX for Dummies Questions & Answers

Filtering records from 1 file based on some manipulation doen on second file

Hi, I am looking for an awk script which should help me to meet the following requirement: File1 has records in following format INF: FAILEd RECORD AB1234 INF: FAILEd RECORD PQ1145 INF: FAILEd RECORD AB3215 INF: FAILEd RECORD AB6114 ............................ (2 Replies)
Discussion started by: mintu41
2 Replies

8. Shell Programming and Scripting

Awk to convert a text file to CSV file with some string manipulation

Hi , I have a simple text file with contents as below: 12345678900 971,76 4234560890 22345678900 5971,72 5234560990 32345678900 71,12 6234560190 the new csv-file should be like: Column1;Column2;Column3;Column4;Column5 123456;78900;971,76;423456;0890... (9 Replies)
Discussion started by: FreddyDaKing
9 Replies

9. Shell Programming and Scripting

Populating File data with custom manipulation on file names

Hi, I am confused how to proceed firther please find the problem below: Input Files: DCIA_GEOG_DATA_OCEAN.TXT DCIA_GEOG_DATA_MCRO.TXT DCIA_GEOG_DATA_CVAS.TXT DCIA_GEOG_DATA_MCR.TXT Output File Name: MMA_RFC_GEOG_NAM_DIM_LOD.txt Sample Record(DCIA_GEOG_DATA_OCEAN.TXT):(Layout same for... (4 Replies)
Discussion started by: Arun Mishra
4 Replies

10. Shell Programming and Scripting

File manipulation

Hi, I want to update the file with a value at a particular position $cat test.txt COL1=TEST COL2= COL3=AADSDFSDFDSFDFDF I want to update the file with a value for COL2. After update, the file should be like this $cat test.txt COL1=TEST COL2=1 COL3=AADSDFSDFDSFDFDF here 1... (9 Replies)
Discussion started by: vedanta
9 Replies
LedgerSMB::AA(3pm)					User Contributed Perl Documentation					LedgerSMB::AA(3pm)

NAME
LedgerSMB::AA - Contains the routines for managing AR and AP transactions. SYNOPSIS
This module contains the routines for managing AR and AP transactions and many of the reorts (a few others are found in LedgerSMB::RP.pm). All routines require $form->{dbh} to be set so that database actions can be performed. This module is due to be deprecated for active development as soon as a replacement is available. post_transaction() Post transaction uses the following variables in the $form variable: * dbh - the database connection handle * currency - The current users' currency * defaultcurrency - The "normal" currency * department - Unknown * department_id - ID for the department * exchangerate - Conversion between currency and defaultcurrency * invnumber - invoice number * reverse - ? * rowcount - Number of rows in the invoice * taxaccounts - Apply taxes? * taxincluded - ? * transdate - Date of the transaction * vc - Vendor or customer - determines transaction type get_files Returns a list of files associated with the existing transaction. This is provisional, and will change for 1.4 as the GL transaction functionality is {ref_key => $self->{id}, file_class => 1} rewritten delete_transaction(\%myconfig, $form) Deletes a transaction identified by $form->{id}, whether it is an ar or ap transaction is identified by $form->{vc}. $form->{invnumber} used for the audittrail routine. transactions(\%myconfig, $form) Generates the transaction and outstanding reports. Form variables used in this function are: approved: whether or not transactions must be approved to show up transdatefrom: Earliest day of transactions transdateto: Latest day of transactions month, year, interval: Used in palce of transdatefrom and transdate to vc: 'customer' for ar, 'vendor' for ap. meta_number: customer/vendor number entity_id: A specific entity id parts_id: Show transactions including a specific part department_id: Transactions for a department entity_credit_account: As an alternate for meta_number to identify a customer of vendor credit account invoice_type: 3 for on-hold, 2 for active The transaction list is stored at: @{$form->{transactions}} get_name(\%myconfig, $form) Retrieves the last account used. Also retrieves tax accounts, departments, and a few other things. Form variables used: vc: customer or vendor ${vc}_id: id of vendor/customemr transdate: Transaction date desired Sets the following form variables currency exchangerate forex taxaccounts taxform_exist($form, $cv_id) Determines if a taxform attached to the entity_credit_account record (where the id field is the same as $cv_id) exists. Returns true if it exists, false if not. update_ac_tax_form($form,$dbh,$entry_id,$report) Updates the ac_tax_form checkbox for the acc_trans.entry_id (where it is the same as $entry_id). If $report is true, sets it to true, if false, sets it to false. $report must be a valid *postgresql* bool value (0/1, t/f, 'true'/'false'). get_taxchech($entry_id,$dbh) Returns true if the acc_trans record has been set to reportable in the past false otherwise. save_intnotes($form) Saves the $form->{intnotes} into the ar/ap.intnotes field. COPTYRIGHT
# LedgerSMB # Small Medium Business Accounting software # http://www.ledgersmb.org/ # Copyright (C) 2006-2010 # This work contains copyrighted information from a number of sources all used # with permission. # # This file contains source code included with or based on SQL-Ledger which # is Copyright Dieter Simader and DWS Systems Inc. 2000-2005 and licensed # under the GNU General Public License version 2 or, at your option, any later # version. For a full list including contact information of contributors, # maintainers, and copyright holders, see the CONTRIBUTORS file. # # Original Copyright Notice from SQL-Ledger 2.6.17 (before the fork): # Copyright (C) 2006 # # Author: DWS Systems Inc. # Web: http://www.sql-ledger.org # # Contributors: # # # See COPYRIGHT file for copyright information perl v5.14.2 2012-03-26 LedgerSMB::AA(3pm)
All times are GMT -4. The time now is 08:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy