Sponsored Content
Full Discussion: Changing time-stamp with sed
Top Forums Shell Programming and Scripting Changing time-stamp with sed Post 302875397 by Corona688 on Tuesday 19th of November 2013 11:31:25 AM
Old 11-19-2013
The feature you are looking for is called a backreference, you can quote parts of text inside \( \) and refer to them later with \1 \2 \3 ...

Code:
sed 's/:\([0-5]\)[1-5]:/:\10:/g' file.txt

This User Gave Thanks to Corona688 For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to MV without changing Time Stamp

Hi, I need to move the set of files, and it should be same time stamp as previous. How to do this? (3 Replies)
Discussion started by: redlotus72
3 Replies

2. Shell Programming and Scripting

Date Time Stamp

I'm trying to write a script that checks the DTS of a file the compares it to the current time. If greater that 60 mins has gone by and the file has not been written to alert. So far I have the time pulled from the file but I dont know how to compare the times against a 60 min difference. ... (2 Replies)
Discussion started by: jarich
2 Replies

3. Shell Programming and Scripting

copying a file without changing date stamp.

Hi, I am using the below copy command, to copy the file sbn to sbn1, cp sbn sbn1 but its changing the date stamp of file sbn1, but i dont want to change the date stamp of sbn1. Could you please help me out in this. (3 Replies)
Discussion started by: shivanete
3 Replies

4. Shell Programming and Scripting

Time stamp calculation

Hi all; I'm relatively new to scripting,I am working on a monitoring script.....where in i have to write subroutine which does the follows: It will check the time stamp of a file ( Oracle remarchive files) and compare it with existing time.If the time difference happen to be more than 90... (6 Replies)
Discussion started by: maverick_here
6 Replies

5. Shell Programming and Scripting

Changing File Time Stamp (Bash Script)

I need some help recovering from a "slight" screwup. We just moved 3 TB of data from one RAID Array to another. Low lever archive files. This was done with a regular cp (for some reason) and now we have lost all the timestamps on the files, and we urgently need to get the timestamps back on these... (7 Replies)
Discussion started by: chj
7 Replies

6. UNIX for Dummies Questions & Answers

How to get the next time stamp in perl?

Hi, I have to find the next time stamp in perl. Here is the code. @time = loaltime(time); print "\n Present time: $time:$time:$time \n"; For example if the time is: "12:55:02" after some process the time becomes 1:00:00. How do i check when it becomes 00:00 i.e from "12:55:02... (0 Replies)
Discussion started by: vanitham
0 Replies

7. Shell Programming and Scripting

regarding time stamp

hi everyone i am facing a strange problem here suppose content of my file is a=1,2,3 b=2,3,4 c=4,5,6 time= now the problem is i want to add value in front of time variable and the value should be i format only "HHMMSS" so it should be like this a=1,2,3 b=2,3,4 c=4,5,6... (3 Replies)
Discussion started by: aishsimplesweet
3 Replies

8. Shell Programming and Scripting

How to get time duration between two human readable time stamp in Unix?

Here is two time I have: Jul 12 16:02:01 Jul 13 01:02:01 and how can I do a simple match to get difference between two time which is 09:00:00 Thanks in advance. (3 Replies)
Discussion started by: ford99
3 Replies

9. Solaris

System time and Cron time stamp not matching

On Solaris 10 server the system date won't match with the timestamp on files created by a cron jobs, Please help here is what i get when i check for system date infodba-ie10ux014:/tcpdv1_ie10/tcadmin/bin\n\r-> date Tue Apr 24 15:27:43 GMT 2012at same time i executed a cron job, and checked... (4 Replies)
Discussion started by: karghum
4 Replies

10. Shell Programming and Scripting

Difference between time stamp

Hi All i have a file data like below format A, B 2016-04-14 16:30:00,2016-04-14 16:31:17 2016-04-14 16:40:00,2016-04-14 16:41:10 2016-04-14 16:50:00,2016-04-14 16:50:41 2016-04-14 17:00:00,2016-04-14 17:00:35 2016-04-14 17:10:00,2016-04-14 17:11:48 2016-04-14 17:20:00,2016-04-14 17:20:37 i... (2 Replies)
Discussion started by: Tarak_nath
2 Replies
MooseX::Declare::Context(3pm)				User Contributed Perl Documentation			     MooseX::Declare::Context(3pm)

NAME
MooseX::Declare::Context - Per-keyword declaration context DESCRIPTION
This is not a subclass of Devel::Declare::Context::Simple, but it will delegate all default methods and extend it with some attributes and methods of its own. A context object will be instanciated for every keyword that is handled by MooseX::Declare. If handlers want to communicate with other handlers (for example handlers that will only be setup inside a namespace block) it must do this via the generated code. In addition to all the methods documented here, all methods from Devel::Declare::Context::Simple are available and will be delegated to an internally stored instance of it. ATTRIBUTES
caller_file A required "Str" containing the file the keyword was encountered in. preamble_code_parts An "ArrayRef" of "CodePart"s that will be used as preamble. A preamble in this context means the beginning of the generated code. scope_code_parts These parts will come before the actual body and after the "preamble_code_parts". It is an "ArrayRef" of "CodePart"s. cleanup_code_parts An "ArrayRef" of "CodePart"s that will not be directly inserted into the code, but instead be installed in a handler that will run at the end of the scope so you can do namespace cleanups and such. stack An "ArrayRef" that contains the stack of handlers. A keyword that was only setup inside a scoped block will have the blockhandler be put in the stack. METHODS
add_preamble_code_parts(CodePart @parts) Object->add_preamble_code_parts (CodeRef @parts) See "add_cleanup_code_parts". add_scope_code_parts(CodePart @parts) Object->add_scope_code_parts (CodeRef @parts) See "add_cleanup_code_parts". add_cleanup_code_parts(CodePart @parts) Object->add_cleanup_code_parts (CodeRef @parts) For these three methods please look at the corresponding *_code_parts attribute in the list above. These methods are merely convenience methods that allow adding entries to the code part containers. inject_code_parts_here True Object->inject_code_parts_here (CodePart @parts) Will inject the passed "CodePart"s at the current position in the code. peek_next_char Str Object->peek_next_char () Will return the next char without stripping it from the stream. inject_code_parts Object->inject_code_parts ( Bool :$inject_cleanup_code_parts, CodeRef :$missing_block_handler ) This will inject the code parts from the attributes above at the current position. The preamble and scope code parts will be inserted first. Then then call to the cleanup code will be injected, unless the options contain a key named "inject_cleanup_code_parts" with a false value. The "inject_if_block" method will be called if the next char is a "{" indicating a following block. If it is not a block, but a semi-colon is found and the options contained a "missing_block_handler" key was passed, it will be called as method on the context object with the code to inject and the options as arguments. All options that are not recognized are passed through to the "missing_block_handler". You are well advised to prefix option names in your extensions. TYPES
BlockCodePart An "ArrayRef" with at least one element that stringifies to either "BEGIN" or "END". The other parts will be stringified and used as the body for the generated block. An example would be this compiletime role composition: ['BEGIN', 'with q{ MyRole }'] CodePart A part of code represented by either a "Str" or a "BlockCodePart". SEE ALSO
o MooseX::Declare o Devel::Declare o Devel::Declare::Context::Simple AUTHOR
Florian Ragwitz <rafl@debian.org> COPYRIGHT AND LICENSE
This software is copyright (c) 2008 by Florian Ragwitz. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.18.2 2013-12-14 MooseX::Declare::Context(3pm)
All times are GMT -4. The time now is 09:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy