Sponsored Content
Top Forums Shell Programming and Scripting Awk help required for formatting digits. Post 302600595 by nua7 on Tuesday 21st of February 2012 01:33:58 PM
Old 02-21-2012
Thanks Scott.

Here is the input file :

Code:
0116WORCE   STD       KAHN                YETTA     UF1929042101453                         112.00      58.40E

0115NORFO   STD       CHETKAUSKAS         LONGIE       M1922060502021                           0.00       0.00E

0115NORFO   STD       CHETKAUSKAS         FLORENCE     F1917122102021                           0.00       0.00E

0104MIDDL   STD       DRISCOLL            TERESA      CF1928122101867                         112.00      58.40E

Now I need to consider the last 2 records in the file(ignoring E) and merge them together (removing the decimal point) and total length would 12 characters each.
Each field would have total 6 characters after the decimal point is removed.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Formatting digits

I want to check the argument in KSH. If the user type in the prompt 'find 3' it will format 3 to 003 to match the data in the text file. Same as with 10 to 010. Always begins with 0. eg. >find 3 Output: 003 >find 30 Output: 030 (7 Replies)
Discussion started by: harry0013
7 Replies

2. UNIX Desktop Questions & Answers

Help required with formatting

I would appreciate any help (sed / awk / perl) on the following question. I have the file in the following format. Note that the records are separated by the line that starts with the word "TRACE".I want the 5th and 6th values on the line starting with "TRACE" to be repeated down the file until the... (3 Replies)
Discussion started by: digipak
3 Replies

3. Shell Programming and Scripting

Help required with formatting in scripting

Hi Friends, I need to write a script which reads the file and prints them horizontally. For example, the file contains something like x1 x2 x3 x4 x5 my script reads this file as "for i in `cat filename`", but I need an output something like "config file = x1.ccfg,... (3 Replies)
Discussion started by: dineeshkg
3 Replies

4. Shell Programming and Scripting

awk search between 2 digits a string

I would like to search between two a string. I thought this would be easy. The is always at the beginning of a line. The code: gawk '/^/{d=$1},/searchstring/,/^(d+1)/' or gawk '/^/,/searchstring/,/^/' did not return the desired result. inputfile.txt 999 some text searchstring some... (6 Replies)
Discussion started by: sdf
6 Replies

5. Shell Programming and Scripting

awk concat lines between 2 sequent digits

I would like to print string between two sequent digits and concatenate it into one single line. input.txt 99 cord, rope, strand, twine, twist, 100 strand, twine, twist, cord, rope 101 strand, twine, twist, twine, twist, cord, rope 105 cord, rope ,twi ... (8 Replies)
Discussion started by: sdf
8 Replies

6. Shell Programming and Scripting

Find filenames with three digits and add zeros to make five digits

Hello all! I've looked all over the internet and this site and have come up a loss with an easy way to make a bash script to do what I want to do. I have a file with a naming convention as follows: 2012-01-18 string of words here 123.jpg 2012-01-18 string of words here 1234.jpg 2012-01-18... (2 Replies)
Discussion started by: Buzzman25
2 Replies

7. Shell Programming and Scripting

awk changes to cut number of digits

HCPM1ONDB00014800011800000589009211201 L201307022013070228AUD 00000000031. 000965105800000000000000000000000 MOBITV KEYA ... (4 Replies)
Discussion started by: mirwasim
4 Replies

8. Shell Programming and Scripting

Formatting required with the output

i have a o/p from find command that needs to be formatted currently when i'm running find . -name "v.info" it is giving below o/p /o/a/b/c/v.info /o/a/b/c/d/v.info /o/aa/bb/cc/v.info /o/aa/bb/cc/dd/v.info my requirement is if v.info is coming under sub-directories it shul be... (15 Replies)
Discussion started by: nikhil jain
15 Replies

9. UNIX for Beginners Questions & Answers

Using sed or awk to replace digits in files

Hello; I am not good at file and stream editing. I need to replace a few digits in two files. The lines in files looks like this: Line in the first file, /dw300/data/obe/2019273.L800JR.1909.273 Line in second file, 1|2019273.L800JR.1909.273 I will write a function to connect to... (7 Replies)
Discussion started by: duke0001
7 Replies

10. UNIX for Beginners Questions & Answers

sed / awk script to delete the two digits from first 3 digits

Hi All , I am having an input file as stated below 5728 U_TOP_LOGIC/U_CM0P/core/u_cortexm0plus/u_top/u_sys/u_core/r03_q_reg_20_/Q 011 611 U_TOP_LOGIC/U_CM0P/core/u_cortexm0plus/u_top/u_sys/u_core/r04_q_reg_20_/Q 011 3486... (4 Replies)
Discussion started by: kshitij
4 Replies
ldcvt(3C)																 ldcvt(3C)

NAME
_ldecvt(), _ldfcvt(), _ldgcvt() - convert long-double floating-point number to string SYNOPSIS
Obsolescent Interfaces DESCRIPTION
converts value to a null-terminated string of ndigit digits and returns a pointer to the string. The high-order digit is non-zero, unless the value is zero. The low-order digit is rounded. The position of the radix character relative to the beginning of the string is stored indirectly through decpt (negative means to the left of the returned digits). The radix character is not included in the returned string. If the sign of the result is negative, the word pointed to by sign is non-zero; other- wise it is zero. is identical to except that the correct digit has been rounded for printf (FORTRAN F-format) output of the number of digits specified by ndigit. Convert the value to a null-terminated string in the array pointed to by buf and return buf. It produces ndigit significant digits in FORTRAN F-format if possible, or E-format otherwise. A minus sign, if required, and a radix character are included in the returned string. Trailing zeros are suppressed. The radix character is determined by the currently loaded NLS environment (see setlocale(3C)). If has not been called successfully, the default NLS environment, "C" is used (see lang(5)). The default environment specifies a period as the radix character. Obsolescent Interfaces convert long-double floating-point number to string. RETURN VALUE
is returned for Not-a-Number, and is returned for Infinity. WARNINGS
The values returned by and point to data whose content is overwritten by subsequent calls to these interfaces by the same thread. and are obsolescent interfaces supported only for compatibility with existing DCE applications. New multithreaded applications should use and EXTERNAL INFLUENCES
Locale The category determines the radix character. International Code Set Support Single-byte character code sets are supported. AUTHOR
and were developed by HP. SEE ALSO
setlocale(3C), printf(3S), lang(5), thread_safety(5). ldcvt(3C)
All times are GMT -4. The time now is 01:12 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy