Sponsored Content
Full Discussion: replace time format
Top Forums Shell Programming and Scripting replace time format Post 302115448 by happyv on Wednesday 25th of April 2007 12:35:51 AM
Old 04-25-2007
Quote:
Originally Posted by ghostdog74
one way.
Code:
awk 'BEGIN {FS = "," ; OFS = ","} 
            { if (length($6) > 5) {
                        $6 = substr($6,1,length($6)-3) 
              }
              print $0 
            }' "file"

output:
Code:
 # ./test1.sh
00001,CLIENT,Company,1218,N,1:04,35,0.211,0,0.211,1.155531,0:00,0,0,0,0,0,1:04,35,0.211,0,0.211,1.15 5531,foold store,USD
00001,CLIENT,Company,1219,N,23:36,42,21.127,0,21.127,115.700959,0:00,0,0,0,0,0,23:36,42,21.127,0,21. 127,115.700959,food store,USD
00001,CLIENT,Company,1220,N,26:17,43,38.091,0,38.091,208.603457,0:00,0,0,0,0,0,26:17:00,43,38.091 ,0,38.091,208.603457,food store,USD
00001,CLIENT,Company,1221,N,27:35,111,33.775,0,33.775,184.967099,0:00,0,0,0,0,0,27:35:00,111,33.7 75,0,33.775,184.967099, food store, US$

Thx, but i forgot to mentioned that the field 18 also have the same issue, how can i fix it as well?
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

time format..

HI.. I have some files...when doing "ls -l" its like this.. -rwxr-xr-x 1 e2e e2e 747 Aug 30 15:18 abc.txt how can I get the number YYYYMMDD from this...( since I need to compare this number with some other value..) with the help of date/awk/sed/epoch or whatever u... (1 Reply)
Discussion started by: clx
1 Replies

2. Shell Programming and Scripting

help in time format

how to grep 30 mins from starting time of script let for example,script runs at 02:00am....i want to grep from 01.30 till 02:00 ------------------------------------------------------------------- how to achive this in a k-shell script ? (3 Replies)
Discussion started by: ali560045
3 Replies

3. Shell Programming and Scripting

Convert Epoch time format to normal date time format in the same file

I have a file named "suspected" with series of line like these : {'protocol': 17, 'service': 'BitTorrent KRPC', 'server': '219.78.120.166', 'client_port': 52044, 'client': '10.64.68.44', 'server_port': 8291, 'time': 1226506312L, 'serverhostname': ''} {'protocol': 17, 'service': 'BitTorrent... (3 Replies)
Discussion started by: rk4k
3 Replies

4. Shell Programming and Scripting

perl time format

Hay guys, I used time::local module. But i can't get my proper answer from this. I want to extract two time for tomorrow start time and end time. In my code i just hard coded this. But it's not running for every day na. I need to create these time from any function or module. my... (2 Replies)
Discussion started by: pritish.sas
2 Replies

5. Shell Programming and Scripting

Replace a format

I have a file which contains 1.3.6.1.4.1.637.61.1.35.10.19.1.10 1.3.6.1.4.1.637.61.1.35.15.3.1.4 Now i want to replace the last occurance of ".1." to ":" The output should look like 1.3.6.1.4.1.637.61.1.35.10.19:10 1.3.6.1.4.1.637.61.1.35.15.3:4 (6 Replies)
Discussion started by: LavanyaP
6 Replies

6. Shell Programming and Scripting

time format

Hello Guys. I have copied the following from the time man pages time -f "%E real,%U user,%S sys" ls -Fs But I am getting -f: command not found Regards (3 Replies)
Discussion started by: fdc2suxs
3 Replies

7. HP-UX

DATE and TIME format help in HP-UX

Hello, I have date format as shown in red color below Fri, Sep 12, 2012 08:38:05 PM Can anyone help me with command to change this format to yyyy-mm-dd and HH:MM:SS Note: Time should be in 24 hours format I really appreciate your help!! Thanks, Elavarasan (4 Replies)
Discussion started by: Elavarasan
4 Replies

8. Programming

Find gaps in time data and replace missing time value and column 2 value by interpolation in awk

Dear all, I am kindly seeking assistance on the following issue. I am working with data that is sampled every 0.05 hours (that is 3 minutes intervals) here is a sample data from the file 5.00000 15.5030 5.05000 15.6680 5.10000 16.0100 5.15000 16.3450 5.20000 16.7120 5.25000... (4 Replies)
Discussion started by: malandisa
4 Replies

9. Shell Programming and Scripting

Calculate Time diff in milli milliseconds(Time format : HH:MM:SS,NNN)

Hi All, I have one file which contains time for request and response. I want to calculate time difference in milliseconds for each line. This file can contain 10K lines. Sample file with 4 lines. for first line. Request Time: 15:23:45,255 Response Time: 15:23:45,258 Time diff... (6 Replies)
Discussion started by: Raza Ali
6 Replies
DB(3pm) 						 Perl Programmers Reference Guide						   DB(3pm)

NAME
DB - programmatic interface to the Perl debugging API SYNOPSIS
package CLIENT; use DB; @ISA = qw(DB); # these (inherited) methods can be called by the client CLIENT->register() # register a client package name CLIENT->done() # de-register from the debugging API CLIENT->skippkg('hide::hide') # ask DB not to stop in this package CLIENT->cont([WHERE]) # run some more (until BREAK or another breakpt) CLIENT->step() # single step CLIENT->next() # step over CLIENT->ret() # return from current subroutine CLIENT->backtrace() # return the call stack description CLIENT->ready() # call when client setup is done CLIENT->trace_toggle() # toggle subroutine call trace mode CLIENT->subs([SUBS]) # return subroutine information CLIENT->files() # return list of all files known to DB CLIENT->lines() # return lines in currently loaded file CLIENT->loadfile(FILE,LINE) # load a file and let other clients know CLIENT->lineevents() # return info on lines with actions CLIENT->set_break([WHERE],[COND]) CLIENT->set_tbreak([WHERE]) CLIENT->clr_breaks([LIST]) CLIENT->set_action(WHERE,ACTION) CLIENT->clr_actions([LIST]) CLIENT->evalcode(STRING) # eval STRING in executing code's context CLIENT->prestop([STRING]) # execute in code context before stopping CLIENT->poststop([STRING])# execute in code context before resuming # These methods will be called at the appropriate times. # Stub versions provided do nothing. # None of these can block. CLIENT->init() # called when debug API inits itself CLIENT->stop(FILE,LINE) # when execution stops CLIENT->idle() # while stopped (can be a client event loop) CLIENT->cleanup() # just before exit CLIENT->output(LIST) # called to print any output that API must show DESCRIPTION
Perl debug information is frequently required not just by debuggers, but also by modules that need some "special" information to do their job properly, like profilers. This module abstracts and provides all of the hooks into Perl internal debugging functionality, so that various implementations of Perl debuggers (or packages that want to simply get at the "privileged" debugging data) can all benefit from the development of this common code. Currently used by Swat, the perl/Tk GUI debugger. Note that multiple "front-ends" can latch into this debugging API simultaneously. This is intended to facilitate things like debugging with a command line and GUI at the same time, debugging debuggers etc. [Sounds nice, but this needs some serious support -- GSAR] In particular, this API does not provide the following functions: o data display o command processing o command alias management o user interface (tty or graphical) These are intended to be services performed by the clients of this API. This module attempts to be squeaky clean w.r.t "use strict;" and when warnings are enabled. Global Variables The following "public" global names can be read by clients of this API. Beware that these should be considered "readonly". $DB::sub Name of current executing subroutine. %DB::sub The keys of this hash are the names of all the known subroutines. Each value is an encoded string that has the sprintf(3) format "("%s:%d-%d", filename, fromline, toline)". $DB::single Single-step flag. Will be true if the API will stop at the next statement. $DB::signal Signal flag. Will be set to a true value if a signal was caught. Clients may check for this flag to abort time-consuming operations. $DB::trace This flag is set to true if the API is tracing through subroutine calls. @DB::args Contains the arguments of current subroutine, or the @ARGV array if in the toplevel context. @DB::dbline List of lines in currently loaded file. %DB::dbline Actions in current file (keys are line numbers). The values are strings that have the sprintf(3) format "("%s00%s", breakcondition, actioncode)". $DB::package Package namespace of currently executing code. $DB::filename Currently loaded filename. $DB::subname Fully qualified name of currently executing subroutine. $DB::lineno Line number that will be executed next. API Methods The following are methods in the DB base class. A client must access these methods by inheritance (*not* by calling them directly), since the API keeps track of clients through the inheritance mechanism. CLIENT->register() register a client object/package CLIENT->evalcode(STRING) eval STRING in executing code context CLIENT->skippkg('D::hide') ask DB not to stop in these packages CLIENT->run() run some more (until a breakpt is reached) CLIENT->step() single step CLIENT->next() step over CLIENT->done() de-register from the debugging API Client Callback Methods The following "virtual" methods can be defined by the client. They will be called by the API at appropriate points. Note that unless specified otherwise, the debug API only defines empty, non-functional default versions of these methods. CLIENT->init() Called after debug API inits itself. CLIENT->prestop([STRING]) Usually inherited from DB package. If no arguments are passed, returns the prestop action string. CLIENT->stop() Called when execution stops (w/ args file, line). CLIENT->idle() Called while stopped (can be a client event loop). CLIENT->poststop([STRING]) Usually inherited from DB package. If no arguments are passed, returns the poststop action string. CLIENT->evalcode(STRING) Usually inherited from DB package. Ask for a STRING to be "eval"-ed in executing code context. CLIENT->cleanup() Called just before exit. CLIENT->output(LIST) Called when API must show a message (warnings, errors etc.). BUGS
The interface defined by this module is missing some of the later additions to perl's debugging functionality. As such, this interface should be considered highly experimental and subject to change. AUTHOR
Gurusamy Sarathy gsar@activestate.com This code heavily adapted from an early version of perl5db.pl attributable to Larry Wall and the Perl Porters. perl v5.12.5 2012-11-03 DB(3pm)
All times are GMT -4. The time now is 06:45 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy