06-23-2011
Hi thank u for reponding. Actually i am very new to perl scripting.The requirement is to write the header in the file with the timestamp.I am assuming that we are packing the same by converting into EBCDIC format and print the same in file header.
Similarly the requirement is to write the trailer into the file with time stamp and the rowcount.
Please tell me how this can be achieved??
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
ok guys and gals at the moment i am perplexed (prolly cuz i been looking at it to long) but here it is.
OS: sol8
perlver: 5.8.0
shell: ksh
answer must be in perl!!
issue:
when i use pack() it packs the data at the front of the requested field space. normally it wouldnt be a problem if... (1 Reply)
Discussion started by: Optimus_P
1 Replies
2. Shell Programming and Scripting
ok here is a perl date question not asked befor.
i know i am feeling small for not knowing. BUT!!!!
$ENV{TZ}="US/Central";
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime();
how can i do the addition to year so i can get the current year w/o going $ntime=$year+1900;... (3 Replies)
Discussion started by: Optimus_P
3 Replies
3. Shell Programming and Scripting
Hello everyone.
I wrote a perl script to get the two answers from a value: x.
By this, I want to do sqrt($x) in different precision.
#!/usr/bin/perl
print "Input the initial value x:\n";
chomp($x=<STDIN>);
$comp=sqrt($x);
$float_value=pack("f", $comp);
$double_value=pack("d", $comp);... (2 Replies)
Discussion started by: Euler04
2 Replies
4. UNIX for Dummies Questions & Answers
I have a file that contains user id and corresponding password.
Lets say password is "help". The below command will create a hex value for string "help".
perl -e 'print unpack "H*","help"'
So now password is in encoded format.
Then I decoded it in the script where am fetching the... (1 Reply)
Discussion started by: max_payne1234
1 Replies
5. Shell Programming and Scripting
Hello All,
I am facing a warning "Argument "" isn't numeric in localtime at"
what i m using is below
my $timestamp = Timestamp(time);
go_log("###############$timestamp###############");
can some one please suggest the way to avoid this message :confused: (6 Replies)
Discussion started by: NIMISH AGARWAL
6 Replies
6. Shell Programming and Scripting
Hi Experts,
I know how to handle normal date changes in perl. Most of my requirement are full filled with following:
$date1 = strftime "%Y%m%d",localtime;
$date2 = strftime "%Y%m%d",localtime(time -24 * 60 * 60);
$date3 = strftime "%Y%m%d",localtime(time +24 * 60 * 60);
$date4 = strftime... (4 Replies)
Discussion started by: mtomar
4 Replies
7. UNIX for Dummies Questions & Answers
I am using pack/unpack to encyrpt a file.
syntax is below
#!/bin/sh
encrypt=`perl -e 'print unpack "H*","yourpassword"'` -
echo $encrypt >/file/to/store/encrypted/password
pass=`cat /file/to/store/encrypted/password`
decrypt=`perl -e 'print pack "H*",$pass'` ... (2 Replies)
Discussion started by: erinlomo
2 Replies
8. Shell Programming and Scripting
Hi,
I have given like this to get the time of the sub routine.
my $start = localtime();
print "\n start time: $start \n";
Output
start time: Fri Apr 29 01:01:31 2011
I want to know what is the format of the time.
I am not able to follow is is HH:MM:SS or MM:HH:SS os... (2 Replies)
Discussion started by: vanitham
2 Replies
9. Shell Programming and Scripting
Hi,
I'm new to perl scripting and am trying it out.
I have a file written in the following format:
myfile-MMDDYY where MM is the number of the Month; DD the Day and YY the last two of the year... (Apologies for dumbing this down; I'm trying to be clear).
There is a new file put onto my... (2 Replies)
Discussion started by: Astrocloud
2 Replies
10. Shell Programming and Scripting
Hi all,
a=$1 ##
b=`echo "86400 * $a"|bc`
`perl -e 'use POSIX qw(strftime);$now_string = strftime "%d/%m/%Y", localtime(time-$b); print $now_string,"\n";' > date_file`
but im always getting current date; can any one suggest me any the improvement
the above works fine if i use some thing... (2 Replies)
Discussion started by: zozoo
2 Replies
LEARN ABOUT OSX
pcap-savefile
PCAP-SAVEFILE(5@) PCAP-SAVEFILE(5@)
NAME
pcap-savefile - libpcap savefile format
DESCRIPTION
NOTE: applications and libraries should, if possible, use libpcap to read savefiles, rather than having their own code to read savefiles.
If, in the future, a new file format is supported by libpcap, applications and libraries using libpcap to read savefiles will be able to
read the new format of savefiles, but applications and libraries using their own code to read savefiles will have to be changed to support
the new file format.
``Savefiles'' read and written by libpcap and applications using libpcap start with a per-file header. The format of the per-file header
is:
+------------------------------+
| Magic number |
+--------------+---------------+
|Major version | Minor version |
+--------------+---------------+
| Time zone offset |
+------------------------------+
| Time stamp accuracy |
+------------------------------+
| Snapshot length |
+------------------------------+
| Link-layer header type |
+------------------------------+
All fields in the per-file header are in the byte order of the host writing the file. The first field in the per-file header is a 4-byte
magic number, with the value 0xa1b2c3d4. The magic number, when read by a host with the same byte order as the host that wrote the file,
will have the value 0xa1b2c3d4, and, when read by a host with the opposite byte order as the host that wrote the file, will have the value
0xd4c3b2a1. That allows software reading the file to determine whether the byte order of the host that wrote the file is the same as the
byte order of the host on which the file is being read, and thus whether the values in the per-file and per-packet headers need to be byte-
swapped.
Following this are:
A 2-byte file format major version number; the current version number is 2.
A 2-byte file format minor version number; the current version number is 4.
A 4-byte time zone offset; this is always 0.
A 4-byte number giving the accuracy of time stamps in the file; this is always 0.
A 4-byte number giving the "snapshot length" of the capture; packets longer than the snapshot length are truncated to the snapshot
length, so that, if the snapshot length is N, only the first N bytes of a packet longer than N bytes will be saved in the capture.
a 4-byte number giving the link-layer header type for packets in the capture; see pcap-linktype(7) for the LINKTYPE_ values that can
appear in this field.
Following the per-file header are zero or more packets; each packet begins with a per-packet header, which is immediately followed by the
raw packet data. The format of the per-packet header is:
+---------------------------------------+
| Time stamp, seconds value |
+---------------------------------------+
| Time stamp, microseconds value |
+---------------------------------------+
| Length of captured packet data |
+---------------------------------------+
|Un-truncated length of the packet data |
+---------------------------------------+
All fields in the per-packet header are in the byte order of the host writing the file. The per-packet header begins with a time stamp
giving the approximate time the packet was captured; the time stamp consists of a 4-byte value, giving the time in seconds since January 1,
1970, 00:00:00 UTC, followed by a 4-byte value, giving the time in microseconds since that second. Following that are a 4-byte value giv-
ing the number of bytes of captured data that follow the per-packet header and a 4-byte value giving the number of bytes that would have
been present had the packet not been truncated by the snapshot length. The two lengths will be equal if the number of bytes of packet data
are less than or equal to the snapshot length.
SEE ALSO
pcap(3PCAP), pcap-linktype(7)
21 October 2008 PCAP-SAVEFILE(5@)