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
Log::Message::Simple(3pm)				 Perl Programmers Reference Guide				 Log::Message::Simple(3pm)

NAME
Log::Message::Simple - Simplified interface to Log::Message SYNOPSIS
use Log::Message::Simple qw[msg error debug carp croak cluck confess]; use Log::Message::Simple qw[:STD :CARP]; ### standard reporting functionality msg( "Connecting to database", $verbose ); error( "Database connection failed: $@", $verbose ); debug( "Connection arguments were: $args", $debug ); ### standard carp functionality carp( "Wrong arguments passed: @_" ); croak( "Fatal: wrong arguments passed: @_" ); cluck( "Wrong arguments passed -- including stacktrace: @_" ); confess("Fatal: wrong arguments passed -- including stacktrace: @_" ); ### retrieve individual message my @stack = Log::Message::Simple->stack; my @stack = Log::Message::Simple->flush; ### retrieve the entire stack in printable form my $msgs = Log::Message::Simple->stack_as_string; my $trace = Log::Message::Simple->stack_as_string(1); ### redirect output local $Log::Message::Simple::MSG_FH = *STDERR; local $Log::Message::Simple::ERROR_FH = *STDERR; local $Log::Message::Simple::DEBUG_FH = *STDERR; ### force a stacktrace on error local $Log::Message::Simple::STACKTRACE_ON_ERROR = 1 DESCRIPTION
This module provides standardized logging facilities using the "Log::Message" module. FUNCTIONS
msg("message string" [,VERBOSE]) Records a message on the stack, and prints it to "STDOUT" (or actually $MSG_FH, see the "GLOBAL VARIABLES" section below), if the "VERBOSE" option is true. The "VERBOSE" option defaults to false. Exported by default, or using the ":STD" tag. debug("message string" [,VERBOSE]) Records a debug message on the stack, and prints it to "STDOUT" (or actually $DEBUG_FH, see the "GLOBAL VARIABLES" section below), if the "VERBOSE" option is true. The "VERBOSE" option defaults to false. Exported by default, or using the ":STD" tag. error("error string" [,VERBOSE]) Records an error on the stack, and prints it to "STDERR" (or actually $ERROR_FH, see the "GLOBAL VARIABLES" sections below), if the "VERBOSE" option is true. The "VERBOSE" options defaults to true. Exported by default, or using the ":STD" tag. carp(); Provides functionality equal to "Carp::carp()" while still logging to the stack. Exported by using the ":CARP" tag. croak(); Provides functionality equal to "Carp::croak()" while still logging to the stack. Exported by using the ":CARP" tag. confess(); Provides functionality equal to "Carp::confess()" while still logging to the stack. Exported by using the ":CARP" tag. cluck(); Provides functionality equal to "Carp::cluck()" while still logging to the stack. Exported by using the ":CARP" tag. CLASS METHODS
Log::Message::Simple->stack() Retrieves all the items on the stack. Since "Log::Message::Simple" is implemented using "Log::Message", consult its manpage for the function "retrieve" to see what is returned and how to use the items. Log::Message::Simple->stack_as_string([TRACE]) Returns the whole stack as a printable string. If the "TRACE" option is true all items are returned with "Carp::longmess" output, rather than just the message. "TRACE" defaults to false. Log::Message::Simple->flush() Removes all the items from the stack and returns them. Since "Log::Message::Simple" is implemented using "Log::Message", consult its manpage for the function "retrieve" to see what is returned and how to use the items. GLOBAL VARIABLES
$ERROR_FH This is the filehandle all the messages sent to "error()" are being printed. This defaults to *STDERR. $MSG_FH This is the filehandle all the messages sent to "msg()" are being printed. This default to *STDOUT. $DEBUG_FH This is the filehandle all the messages sent to "debug()" are being printed. This default to *STDOUT. $STACKTRACE_ON_ERROR If this option is set to "true", every call to "error()" will generate a stacktrace using "Carp::shortmess()". Defaults to "false" perl v5.18.2 2014-01-06 Log::Message::Simple(3pm)
All times are GMT -4. The time now is 02:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy