10 More Discussions You Might Find Interesting
1. 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
2. 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
3. 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
4. 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
5. 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
6. 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
7. 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
8. 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
9. 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
10. 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