Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

423.Advanced search and replace -- How to convert date from seconds passed since 1970 to YMD format?

User: editor -- 2010-02-17
Hits: 101
Type: Advanced search and replace   
Search all Advanced search and replace examples
Description:
I have a log file with the timestamp in each line, but the timestamp format is the number of seconds passed since 1970, how to convert it to the format of YYYY-mm-dd HH:MM:SS?
Input Sample:
1034323423 start logging ...
1034334234 make operation
1034542343 end logging
...
Output Sample:
2002-10-11 16:03:43 start logging ...
2002-10-11 19:03:54 make operation
2002-10-14 04:52:23 end logging
...
Answer:
Hint: You need to Download and install "Replace Pioneer" to finish following steps.
1. ctrl-o open source text file
2. ctrl-h open 'Replace' dialog
* set 'Replace Unit' to 'Chars'
* set 'Replace Scope' to 'Line'
* in search for pattern, enter:

* in replace with pattern, enter:

3. Click 'Replace', done!
Download Script:  scripts/423.rst.zip

Similar Examples:
How to convert each line of a text file to the new format? (59%)
How to merge the data of second column base on value of first column? (50%)
How to convert the date in a text file into GMT(Greenwich Mean Time)? (48%)
How to convert Hexidecimal IP addresses in text file into decimal format? (48%)
How to convert IP addresses in text file into Hexidecimal format? (48%)
How to convert the text from decimal to hex in a file? (48%)
How to convert the text from hex to decimal in a file? (48%)
How to count the occurrance of specific pattern in each line of text file? (47%)

Check Demo of Advanced search and replace