Sponsored Content
Full Discussion: add line numbers
Top Forums Shell Programming and Scripting add line numbers Post 65512 by esham on Sunday 6th of March 2005 08:38:50 AM
Old 03-06-2005
add line numbers

Hello..

I have got one file ...
I want to add line numbers with space form starting to ending..

for example...if the file is
--------------------------

sand sorcd 2345 345
recds 234 234 5687
yeres 568 988 erfg4 67

--------------------------
I need the output

----------------------------
1 sand sorcd 2345 345
2 recds 234 234 5687
3 yeres 568 988 erfg4 67
------------------------------

please help..
thanks in advance
esham
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Printing line numbers

Maybe this question is out there, but I searched and didnt see it. To print my files I use more filename | lpr -Pprinter I would like to print my scripts with line numbers. How do I do this? (2 Replies)
Discussion started by: MizzGail
2 Replies

2. UNIX for Advanced & Expert Users

Add line numbers to end of each line

Hi i would like to add line numbers to end of each line in a file. I am able to do it in the front of each line using sed, but not able to add at the end of the file. Can anyone suggest The following code adds line number to start of each line sed = filename | sed 'N;s/\n/\t/' how can i... (5 Replies)
Discussion started by: rudoraj
5 Replies

3. Shell Programming and Scripting

Display Line numbers

Hi all experts, I am getting error in my shell scripts and i want to find out which lines is in errors. How i can display the line numbers . Is it NU command? Please give me some suggestions. (4 Replies)
Discussion started by: ma466
4 Replies

4. Shell Programming and Scripting

how to add line numbers in text file

Hi all How to add line numbers in text file.. ex abcd cdef result 1. abcd 2. cdef thx in advance (4 Replies)
Discussion started by: suryanarayana
4 Replies

5. Shell Programming and Scripting

More with line numbers

Hi All, How to get line numbers when we more on a file in LINUX thanks firestar (1 Reply)
Discussion started by: firestar
1 Replies

6. Shell Programming and Scripting

How to get evenly Line numbers?

hi there , i m new to unix , i d like to ask how can a get only even numbered lines matches with the word i search from txt file for example : 3461:1.D. The copyright laws of the place where you are located also govern 3471:1.E. Unless you have removed all references to Project... (17 Replies)
Discussion started by: brhn
17 Replies

7. UNIX for Dummies Questions & Answers

grep to get line numbers

I know if i use grep -n that the output will have the lines numbered but is there a way to grep the actually line number. so like this grep -n "one" /usr/dict/numbers 1:one 21:twenty-one 31:thirty-one 41:forty-one 51:fifty-one 61:sixty-one 71:seventy-one 81:eighty-one 91:ninety-one ... (1 Reply)
Discussion started by: alindner
1 Replies

8. Shell Programming and Scripting

Assign Line Numbers to each line of the file

Hi! I'm trying to assign line numbers to each line of the file for example consider the following.. The contents of the input file are hello how are you? I'm fine. How about you? I'm trying to get the following output.. 1 hello how are you? 2 I'm fine. 3 How about you? ... (8 Replies)
Discussion started by: abk07
8 Replies

9. Shell Programming and Scripting

How to add line numbers (multiples of 5: 0,5,10,15,20) to a text file?

Hi, I need to number the lines in my text file. I know how to do this with standard numbering (1,2,3,4, etc) but I need to count in multiples of 5, beginning 0,5,10,15... example existing file: abcd efg hijklm nopqrs desired output 0 abcd 5 efg 10 hijklm 15 ... (11 Replies)
Discussion started by: livbaddeley
11 Replies

10. Shell Programming and Scripting

Efficient awk way to add numbers in line fields

data.now: blah1,dah,blaha,sweet,games.log,5297484456,nagios-toin,529748456,on__host=93 SERVICE__ALERT_=51 Warning___The__results__of__service=16 Warning___on__host=92 Auto_save__of__retention__data__completed=1 Warning___Return=68 PASSIVE__SERVICE__CHECK_=53 ,1026--1313,1... (12 Replies)
Discussion started by: SkySmart
12 Replies
localeconv(3C)															    localeconv(3C)

NAME
localeconv() - query the numeric formatting conventions of the current locale SYNOPSIS
DESCRIPTION
The function sets the components of an object of type (defined in with values appropriate for the formatting of numeric quantities (mone- tary and otherwise) according to the rules of the program's current locale (see setlocale(3C)). The members of the structure with type are strings, any of which (except can point to "" (the empty string) to indicate that the value is not available in the current locale or is of zero length. The members with type are non-negative numbers, any of which can be (defined in to indicate that the value is not available in the current locale. The members include the following: The decimal point character used to format nonmonetary quantities. This is the same value as that returned by a call to with as its argument (see nl_langinfo(3C)). The character used to separate groups of digits to the left of the decimal point character in formatted nonmonetary quantities. This is the same value as that returned by a call to with as its argument (see nl_langinfo(3C)). A string where the numeric value of each byte indicates the size of each group of digits in formatted nonmonetary quantities. The international currency symbol applicable to the current locale. The first three characters contain the alphabetic international currency symbol in accordance with those specified in The fourth character (immediately preceding the null character) is the character used to separate the international currency symbol from the monetary quantity. The local currency symbol applicable to the current locale. This value along with positioning information is returned by a call to with as its argument (see nl_langinfo(3C)). The decimal point used to format monetary quantities. The separator for groups of digits to the left of the decimal point in formatted monetary quantities. A string where the numeric value of each byte indicates the size of each group of digits in formatted monetary quantities. The string used to indicate a positive valued formatted monetary quantity. The string used to indicate a negative valued formatted monetary quantity. The number of fractional digits (those to the right of the decimal point) to be displayed in an internationally formatted monetary quantity. The number of fractional digits (those to the right of the decimal point) to be displayed in a locally formatted monetary quantity. Set to 1 or 0 if the precedes or succeeds the value for a non-negative formatted monetary quantity. Set to a value indicating the separation of the the sign string, and the value of a non-negative formatted monetary quantity. Set to 1 or 0 if the precedes or succeeds the value for a negative formatted monetary quantity. Set to a value indicating the separation of the the sign string, and the value of a negative formatted monetary quantity. Set to a value indicating the positioning of the for a non-negative formatted monetary quantity. Set to a value indicating the positioning of the for a negative formatted monetary quantity. The following members are also available to UNIX 2003 conforming applications: Set to 1 or 0 if the precedes or succeeds the value for a non-negative internationally formatted monetary quantity. Set to a value indicating the separation of the the sign string, and the value of a non-negative internationally formatted monetary quantity. Set to 1 or 0 if the precedes or succeeds the value for a negative internationally formatted monetary quantity. Set to a value indicating the separation of the the sign string, and the value of a negative internationally formatted monetary quantity. Set to a value indicating the positioning of the for a non-negative internationally formatted monetary quantity. Set to a value indicating the positioning of the for a negative internationally formatted monetary quantity. The numeric value of each byte of and is interpreted according to the following: No further grouping is to be performed. The previous byte is to be repeatedly used for the remainder of the digits. other The value is the number of digits that comprise the current group. The next byte is examined to determine the size of the next group of digits to the left of the current group. The values of and are interpreted according to the following: No space separates the currency symbol and value. If the currency symbol and sign string are adjacent, a space separates them from the value; otherwise, a space separates the currency symbol from the value. If the currency symbol and sign string are adjacent, a space separates them; otherwise, a space separates the sign string from the value. For and the fourth character of is used instead of a space for UNIX 2003 conforming applications. The values of and are interpreted according to the following: Parentheses surround the quantity and or The sign string precedes the quantity and or The sign string succeeds the quantity and or The sign string immediately precedes the or The sign string immediately succeeds the or behaves as if no library function calls EXTERNAL INFLUENCES
Locale The category influences the and members of the structure referenced by the pointer returned from a call to The category influences all of the other members of this structure. International Code Set Support Single and multibyte character codesets are supported. RETURN VALUE
returns a pointer to the filled-in EXAMPLES
The following table illustrates the formatting used in five languages for monetary quantities. +---------------+-----------------+-----------------+----------------------+ | Country | Positive format | Negative format | International format | +---------------+-----------------+-----------------+----------------------+ |en_US.iso88591 | $1,234.56 | -$1,234.56 | USD 1,234.56 | +---------------+-----------------+-----------------+----------------------+ |it_IT.iso88591 | L.1.234 | -L.1.234 | ITL.1.234 | +---------------+-----------------+-----------------+----------------------+ |nl_NL.iso88591 | F 1.234,56 | F -1.234,56 | NLG 1.234,56 | +---------------+-----------------+-----------------+----------------------+ |no_NO.iso88591 | kr1.234,56 | kr1.234,56- | NOK 1.234,56 | +---------------+-----------------+-----------------+----------------------+ |pt_PT.iso88591 | 1,234$56 | -1,234$56 | PTE 1,234$56 | +---------------+-----------------+-----------------+----------------------+ For these five languages, the respective values for the monetary members of the structure returned by are: +------------------+----------+-----------+----------+----------+--------+ | | en_US. | it_IT. | nl_NL. | no_NO. | pt_PT. | | iso88591 | iso88591 | .iso88591 | iso88591 | iso88591 | | +------------------+----------+-----------+----------+----------+--------+ |int_curr_symbol | USD | ITL. | NLG | NOK | PTE | +------------------+----------+-----------+----------+----------+--------+ |currency_symbol | $ | L. | F | kr | $ | +------------------+----------+-----------+----------+----------+--------+ |mon_decimal_point | . | "" | , | , | $ | +------------------+----------+-----------+----------+----------+--------+ |mon_thousands_sep | , | . | . | . | , | +------------------+----------+-----------+----------+----------+--------+ |mon_grouping | 3 | 3 | 3 | 3 | 3 | +------------------+----------+-----------+----------+----------+--------+ |positive_sign | "" | "" | "" | "" | "" | +------------------+----------+-----------+----------+----------+--------+ |negative_sign | - | - | - | - | - | +------------------+----------+-----------+----------+----------+--------+ |int_frac_digits | 2 | 0 | 2 | 2 | 2 | +------------------+----------+-----------+----------+----------+--------+ |frac_digits | 2 | 0 | 2 | 2 | 2 | +------------------+----------+-----------+----------+----------+--------+ |p_cs_precedes | 1 | 1 | 1 | 1 | 0 | +------------------+----------+-----------+----------+----------+--------+ |p_sep_by_space | 0 | 0 | 1 | 0 | 0 | +------------------+----------+-----------+----------+----------+--------+ |n_cs_precedes | 1 | 1 | 1 | 1 | 0 | +------------------+----------+-----------+----------+----------+--------+ |n_sep_by_space | 0 | 0 | 1 | 0 | 0 | +------------------+----------+-----------+----------+----------+--------+ |p_sign_posn | 1 | 1 | 1 | 1 | 1 | +------------------+----------+-----------+----------+----------+--------+ |n_sign_posn | 4 | 1 | 4 | 2 | 1 | +------------------+----------+-----------+----------+----------+--------+ WARNINGS
The structure returned by should not be modified by the calling program. Calls to with categories or can overwrite the contents of the structure that points to when it returns (see setlocale(3C)). AUTHOR
was developed by OSF and HP. SEE ALSO
nl_langinfo(3C), setlocale(3C), localedef(4), langinfo(5), thread_safety(5). STANDARDS CONFORMANCE
localeconv(3C)
All times are GMT -4. The time now is 07:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy