Sponsored Content
Top Forums UNIX for Dummies Questions & Answers getting the current time in Epoch format Post 302420794 by omoyne on Wednesday 12th of May 2010 12:12:25 PM
Old 05-12-2010
thanks but I was looking for something more straightforward Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to convert epoch time to readible format?

Hi, I would like to convert epoch time from the logs to readible fromat. How do I do it within shell? Thanks! (11 Replies)
Discussion started by: cin2000
11 Replies

2. 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

3. Shell Programming and Scripting

Convert Epoch Time to Standard Date and Time & Vice Versa

Hi guys, I know that this topic has been discuss numerous times, and I have search the net and this forum for it. However, non able to address the problem I faced so far. I am on Solaris Platform and unable to install additional packages like the GNU date and gawk to make use of their... (5 Replies)
Discussion started by: DrivesMeCrazy
5 Replies

4. Shell Programming and Scripting

Convert epoch to human readable date & time format

Hello I have log file from solaris system which has date field converted by Java application using System.currentTimeMillis() function, example is 1280943608380 which equivalent to GMT: Wed, 04 Aug 2010 17:40:08 GMT. Now I need a function in shell script which will convert 1280943608380... (3 Replies)
Discussion started by: Yaminib
3 Replies

5. Shell Programming and Scripting

Using awk or nawk to convert epoch time to date format

Looking for some help and usually when I do a search this site comes up. Hopefully someone can give me a little direction as to how to use one of these two commands to achieve what I'm trying to do. What am I trying to do? I need to take the time value in epoch format returned from the... (5 Replies)
Discussion started by: minigts
5 Replies

6. Shell Programming and Scripting

converting epoch time to ddmmyy format

I can not find a working script or way to do this on sun solaris , can someone please guide me? e.g 1327329935 epoch secs = 012312 (ddmmyy) thanks (5 Replies)
Discussion started by: aliyesami
5 Replies

7. Shell Programming and Scripting

Report the current time in Binary format

Hey fellas, I am trying to report the current time in a binary format which is overwriting every second. So far I wrote following script which I know looks stupid since I'm a newbie! ;) #!/bin/bash while true; do clear; date | awk '{print $4}' | awk -F ":" '{print... (4 Replies)
Discussion started by: @man
4 Replies

8. Shell Programming and Scripting

Current triggered time to epoch seconds

I have a requirement to find long running instances for notifying the stake holders based on the triggered time in AIX. I am not sure how to convert the triggered time to epoch seconds. For example : Current triggered time of instance is 13:06:19 -> how to convert this into epoch in the... (5 Replies)
Discussion started by: chandu123
5 Replies

9. Shell Programming and Scripting

Convert epoch time stamp into human readable format

Can someone help me to write a shell script to convert epoch timestamp into human readable format 1394553600,"test","79799776.0","19073982.728571","77547576.0","18835699.285714" 1394553600,"test1","80156064.0","19191275.014286","62475360.000000","14200554.720000"... (10 Replies)
Discussion started by: Moon1234
10 Replies

10. Shell Programming and Scripting

Converting a random epoch time into a readable format

I am trying to create a script that will take epoch (input from command line) and convert it into a readable format in bash/shell ---------- Post updated at 08:03 PM ---------- Previous update was at 07:59 PM ---------- #!bin/bash read -p "Please enter a number to represent epoch time:"... (9 Replies)
Discussion started by: sprocket
9 Replies
PCREPRECOMPILE(3)					     Library Functions Manual						 PCREPRECOMPILE(3)

NAME
PCRE - Perl-compatible regular expressions SAVING AND RE-USING PRECOMPILED PCRE PATTERNS If you are running an application that uses a large number of regular expression patterns, it may be useful to store them in a precompiled form instead of having to compile them every time the application is run. If you are not using any private character tables (see the pcre_maketables() documentation), this is relatively straightforward. If you are using private tables, it is a little bit more complicated. However, if you are using the just-in-time optimization feature, it is not possible to save and reload the JIT data. If you save compiled patterns to a file, you can copy them to a different host and run them there. If the two hosts have different endian- ness (byte order), you should run the pcre[16|32]_pattern_to_host_byte_order() function on the new host before trying to match the pattern. The matching functions return PCRE_ERROR_BADENDIANNESS if they detect a pattern with the wrong endianness. Compiling regular expressions with one version of PCRE for use with a different version is not guaranteed to work and may cause crashes, and saving and restoring a compiled pattern loses any JIT optimization data. SAVING A COMPILED PATTERN
The value returned by pcre[16|32]_compile() points to a single block of memory that holds the compiled pattern and associated data. You can find the length of this block in bytes by calling pcre[16|32]_fullinfo() with an argument of PCRE_INFO_SIZE. You can then save the data in any appropriate manner. Here is sample code for the 8-bit library that compiles a pattern and writes it to a file. It assumes that the variable fd refers to a file that is open for output: int erroroffset, rc, size; char *error; pcre *re; re = pcre_compile("my pattern", 0, &error, &erroroffset, NULL); if (re == NULL) { ... handle errors ... } rc = pcre_fullinfo(re, NULL, PCRE_INFO_SIZE, &size); if (rc < 0) { ... handle errors ... } rc = fwrite(re, 1, size, fd); if (rc != size) { ... handle errors ... } In this example, the bytes that comprise the compiled pattern are copied exactly. Note that this is binary data that may contain any of the 256 possible byte values. On systems that make a distinction between binary and non-binary data, be sure that the file is opened for binary output. If you want to write more than one pattern to a file, you will have to devise a way of separating them. For binary data, preceding each pattern with its length is probably the most straightforward approach. Another possibility is to write out the data in hexadecimal instead of binary, one pattern to a line. Saving compiled patterns in a file is only one possible way of storing them for later use. They could equally well be saved in a database, or in the memory of some daemon process that passes them via sockets to the processes that want them. If the pattern has been studied, it is also possible to save the normal study data in a similar way to the compiled pattern itself. How- ever, if the PCRE_STUDY_JIT_COMPILE was used, the just-in-time data that is created cannot be saved because it is too dependent on the cur- rent environment. When studying generates additional information, pcre[16|32]_study() returns a pointer to a pcre[16|32]_extra data block. Its format is defined in the section on matching a pattern in the pcreapi documentation. The study_data field points to the binary study data, and this is what you must save (not the pcre[16|32]_extra block itself). The length of the study data can be obtained by calling pcre[16|32]_fullinfo() with an argument of PCRE_INFO_STUDYSIZE. Remember to check that pcre[16|32]_study() did return a non-NULL value before trying to save the study data. RE-USING A PRECOMPILED PATTERN Re-using a precompiled pattern is straightforward. Having reloaded it into main memory, called pcre[16|32]_pattern_to_host_byte_order() if necessary, you pass its pointer to pcre[16|32]_exec() or pcre[16|32]_dfa_exec() in the usual way. However, if you passed a pointer to custom character tables when the pattern was compiled (the tableptr argument of pcre[16|32]_compile()), you must now pass a similar pointer to pcre[16|32]_exec() or pcre[16|32]_dfa_exec(), because the value saved with the compiled pattern will obviously be nonsense. A field in a pcre[16|32]_extra() block is used to pass this data, as described in the section on matching a pattern in the pcreapi documentation. Warning: The tables that pcre_exec() and pcre_dfa_exec() use must be the same as those that were used when the pattern was compiled. If this is not the case, the behaviour is undefined. If you did not provide custom character tables when the pattern was compiled, the pointer in the compiled pattern is NULL, which causes the matching functions to use PCRE's internal tables. Thus, you do not need to take any special action at run time in this case. If you saved study data with the compiled pattern, you need to create your own pcre[16|32]_extra data block and set the study_data field to point to the reloaded study data. You must also set the PCRE_EXTRA_STUDY_DATA bit in the flags field to indicate that study data is present. Then pass the pcre[16|32]_extra block to the matching function in the usual way. If the pattern was studied for just-in-time opti- mization, that data cannot be saved, and so is lost by a save/restore cycle. COMPATIBILITY WITH DIFFERENT PCRE RELEASES
In general, it is safest to recompile all saved patterns when you update to a new PCRE release, though not all updates actually require this. AUTHOR
Philip Hazel University Computing Service Cambridge CB2 3QH, England. REVISION
Last updated: 12 November 2013 Copyright (c) 1997-2013 University of Cambridge. PCRE 8.34 12 November 2013 PCREPRECOMPILE(3)
All times are GMT -4. The time now is 08:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy