Sponsored Content
Full Discussion: Numbering!
Top Forums UNIX for Dummies Questions & Answers Numbering! Post 13486 by biglemon on Thursday 17th of January 2002 09:51:21 PM
Old 01-17-2002
well.....if i have a file with 10k line...
i want to rename each line in recursive mode...(while loop)?!
form 000,001...999,000,001.....999....etc....

Must i do something like this :

Code:
echo $number+`echo original | cut -c4-` >> newfile

this line by line method will take me one day to complete....
can someone suggest a better way?

Last edited by biglemon; 01-18-2002 at 04:25 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

numbering of process

:confused: How does UNIX handle the numbering of processes? (2 Replies)
Discussion started by: tweety111
2 Replies

2. Shell Programming and Scripting

Numbering

I'm trying to do a script that will look for a log file if it is already there change the name to another name. I.E if log.0 is there rename to log.1 rename log.1 to log.2 rename log.2 to log.3 and so on. Only thing is I got no idea where or what is the best command to use for this? ... (3 Replies)
Discussion started by: merlin
3 Replies

3. UNIX for Advanced & Expert Users

numbering blanks

hello i'm trying to figure out how to number a blank line. For instance this : sed '/./=' file | sed '/./N; s/\n/ /' gives me 1 aaaa 2 bbbbbb 4 cccccc 5 ffkkkfff 6 ffsdfdfs I would like something like this: 1 aaaaa 2 3 bbbbbb 4 5 cccccc And so... (6 Replies)
Discussion started by: wisher115
6 Replies

4. Shell Programming and Scripting

Numbering Lines

Hello everyone, I want get numbered lines from a file. and i can do it with: sed = file.txt | sed "/./N; s/\n/ /" | sed -n "5,7p" but the output that i get is something similar to: 5 line5 6 line6 7 line7 and i want something like this (with 2points after the number): 5:... (6 Replies)
Discussion started by: vibra
6 Replies

5. Shell Programming and Scripting

Numbering duplicates

Hi, I have this large file and sometimes there are duplicates and I want to basically find them and figure how many there are. So I have a file with multiple columns and the last column (9) has the duplicates. eg. yan tar tar man ban tan tub tub tub Basically what I want to... (6 Replies)
Discussion started by: kylle345
6 Replies

6. UNIX for Dummies Questions & Answers

Numbering the rows

If I a list of components, is there anyway to number (like automatically have: 1,2,3,...) the rows of my data? (1 Reply)
Discussion started by: cosmologist
1 Replies

7. Shell Programming and Scripting

help with numbering a file

Hi, All I need to do is number a file. The file looks like this > JJJJJJJJJJJJJJJJJJJJJ > JKJKJKKKKKKJJJ > MMMMYKKKJKKK what I want to do is number it so that theres a numerical value beside the >. >1 JJJJJJJJJJJJJJJJJJJJJ >2 JKJKJKKKKKKJJJ (2 Replies)
Discussion started by: kylle345
2 Replies

8. Shell Programming and Scripting

Incremental numbering?

Would it be possible for a script to duplicate a file and incrementally number it? File in: XXX_007_0580_xxxx_v0016.aep File out: XXX_007_0580_xxxx_v0017.aep If someone knows of a way I'd love to see it. Thanks! (7 Replies)
Discussion started by: scribling
7 Replies

9. Shell Programming and Scripting

Sequential numbering from 1 to ten

Hi I am in a bind, I need create a script that will rename files as they come into a folder with sequential numbering at the begining starting at 1 and proceeding to ten then starting at 1 again. Such as 1_filename.pdf, 2_filename.pdf, 3_filename.pdf, 4_filename.pdf, 5_filename.pdf, 6_filename.pdf,... (6 Replies)
Discussion started by: Paul Walker
6 Replies

10. Shell Programming and Scripting

Numbering by field

I'm not really sure how to explain this but I will try. In the attached file if $4=$4 and $5="-" then the last record is 1 and the one above that is 2, etc... However, $4=$4 and $5="-" then the first record is 1 and the one below that is 2, etc... "-" example: chr10 90694830 90695123... (7 Replies)
Discussion started by: cmccabe
7 Replies
Format(3pm)						User Contributed Perl Documentation					       Format(3pm)

NAME
Locale::Currency::Format - Perl functions for formatting monetary values SYNOPSIS
use Locale::Currency::Format; $amt = currency_format('USD', 1000); # => 1,000.00 USD $amt = currency_format('EUR', 1000, FMT_COMMON); # => EUR1.000,00 $amt = currency_format('USD', 1000, FMT_SYMBOL); # => $1,000.00 $sym = currency_symbol('USD'); # => $ $sym = currency_symbol('GBP', SYM_HTML); # => &#163; $decimals = decimal_precision('USD'); # => 2 $decimals = decimal_precision('BHD'); # => 3 $thou_sep = thousands_separator('USD'); # => , $thou_sep = thousands_separator('EUR'); # => . $dec_sep = decimal_separator('USD'); # => . $dec_sep = decimal_separator('EUR'); # => , currency_set('USD', '#.###,## $', FMT_COMMON); # => set custom format currency_format('USD', 1000, FMT_COMMON); # => 1.000,00 $ currency_set('USD'); # => reset default format The following example illustrates how to use Locale::Currency::Format with Mason. Skip it if you are not interested in Mason. A simple Mason component might look like this: Total: <% 123456789, 'eur' |c %> <%init> use Locale::Currency::Format; $m->interp->set_escape(c => &escape_currency); sub escape_currency { my ($amt, $code) = ${$_[0]} =~ /(.*?)([A-Za-z]{3})/; ${$_[0]} = currency_format($code, $amt, FMT_HTML); } </%init> DESCRIPTION
Locale::Currency::Format is a light-weight Perl module that enables Perl code to display monetary values in the formats recognized internationally and/or locally. "currency_format(CODE, AMOUNT [, FORMAT])" currency_format takes two mandatory parameters, namely currency code and amount respectively, and optionally a third parameter indicating which format is desired. Upon failure, it returns undef and an error message is stored in $Locale::Currency::Format::error. CODE A 3-letter currency code as specified in ISO 4217. Note that old code such as GBP, FRF and so on can also be valid. AMOUNT A numeric value. FORMAT There are five different format options FMT_STANDARD, FMT_COMMON, FMT_SYMBOL, FMT_HTML and FMT_NAME. If it is omitted, the default format is FMT_STANDARD. FMT_STANDARD Ex: 1,000.00 USD, 1.000.000,00 EUR FMT_SYMBOL Ex: $1,000.00 FMT_COMMON Ex: 1.000 Dong (Vietnam), BEF 1.000 (Belgium) FMT_HTML Ex: &#xA3;1,000.00 (pound-sign HTML escape) FMT_NAME Ex: 1,000.00 US Dollar NOTE: By default the trailing zeros after the decimal point will be added. To turn it off, do a bitwise C<or> of FMT_NOZEROS with one of the five options above. Ex: FMT_STANDARD | FMT_NOZEROS will give 1,000 USD "currency_symbol(CODE [, TYPE])" For conveniences, the function currency_symbol is provided for currency symbol lookup given a 3-letter currency code. Optionally, one can specify which format the symbol should be returned - Unicode-based character or HTML escape. Default is a Unicode-based character. Upon failure, it returns undef and an error message is stored in $Locale::Currency::Format::error. CODE A 3-letter currency code as specified in ISO 4217 TYPE There are two available types SYM_UTF and SYM_HTML SYM_UTF returns the symbol (if exists) as an Unicode character SYM_HTML returns the symbol (if exists) as a HTML escape "decimal_precision(CODE)" For conveniences, the function decimal_precision is provided to lookup the decimal precision for a given 3-letter currency code. Upon failure, it returns undef and an error message is stored in $Locale::Currency::Format::error. CODE A 3-letter currency code as specified in ISO 4217 "decimal_separator(CODE)" For conveniences, the function decimal_separator is provided to lookup the decimal separator for a given 3-letter currency code. Upon failure, it returns undef and an error message is stored in $Locale::Currency::Format::error. CODE A 3-letter currency code as specified in ISO 4217 "thousands_separator(CODE)" For conveniences, the function thousands_separator is provided to lookup the thousands separator for a given 3-letter currency code. Upon failure, it returns undef and an error message is stored in $Locale::Currency::Format::error. CODE A 3-letter currency code as specified in ISO 4217 "currency_set(CODE [, TEMPLATE, FORMAT])" currency_set can be used to set a custom format for a currency instead of the provided format. For example, in many non-English speaking countries, the US dollars might be displayed as 2.999,99 $ instead of the usual $2,999.99. In order to accomplish this, one will need to do as follows: use Locale::Currency::Format qw(:default $error); my $currency = 'USD'; my $template = '#.###,## $'; if (currency_set($currency, $template, FMT_COMMON)) { print currency_format($currency, 2999.99, FMT_COMMON), " "; } else { print "cannot set currency format for $currency: $error "; } The arguments to currency_set are: CODE A 3-letter currency code as specified in ISO 4217 TEMPLATE A template in the form #.###,##$, #.### kr, etc. If a unicode character is used, make sure that the template is double-quoted. Ex: currency_set('GBP', "x{00A3}#,###.##", FMT_SYMBOL) If an HTML symbol is wanted, escape its equivalent HTML code. Ex: currency_set('GBP', '&#x00A3;#,###.##', FMT_HTML) FORMAT This argument is required if TEMPLATE is present. The formats FMT_SYMBOL, FMT_COMMON, FMT_HTML are accepted. NOTE! FMT_STANDARD and FMT_NAME will always be in the form <amount><space><code|name> such as 1,925.95 AUD. Hence, currency_set returns an error if FMT_STANDARD or FMT_NAME is specified as FORMAT. With FMT_COMMON, you can always achieve what you would have done with FMT_STANDARD and FMT_NAME, as follows my $amt = 1950.95; currency_set('USD', 'USD #.###,##', FMT_COMMON); print currency_format('USD', $amt, FMT_COMMON); # USD 1,950.95 currency_set('USD', 'US Dollar #.###,##', FMT_COMMON); print currency_format('USD', $amt, FMT_COMMON); # US Dollar 1,950.95 Invoking currency_set with one argument will reset all formats to their original settings. For example currency_set('USD') will clear all previous custom settings for the US currency (ie. FMT_SYMBOL, FMT_HTML, FMT_COMMON). A WORD OF CAUTION Please be aware that some currencies might have missing common format. In that case, currency_format will fall back to FMT_STANDARD format. Also, be aware that some currencies do not have monetary symbol. As countries merge together or split into smaller ones, currencies can be added or removed by the ISO. Please help keep the list up to date by sending your feedback to the email address at the bottom. To see the error, examine $Locale::Currency::Format::error use Locale::Currency::Format; my $value = currency_format('USD', 1000); print $value ? $value : $Locale::Currency::Format::error OR use Locale::Currency::Format qw(:DEFAULT $error); my $value = currency_format('USD', 1000); print $value ? $value : $error Lastly, please refer to perluniintro and perlunicode for displaying Unicode characters if you intend to use FMT_SYMBOL and currency_symbol. Otherwise, it reads "No worries, mate!" SEE ALSO
Locale::Currency, Math::Currency, Number::Format, perluniintro, perlunicode BUGS
If you find any inaccurate or missing information, please send your comments to tnguyen@cpan.org. Your effort is certainly appreciated! CONTRIBUTOR(S) James Kiser <james.kiser@gmail.com> AUTHOR
Tan D Nguyen <tnguyen@cpan.org> COPYRIGHT
This library is free software. You may distribute under the terms of either the GNU General Public License or the Artistic License. perl v5.12.4 2011-07-11 Format(3pm)
All times are GMT -4. The time now is 04:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy