Try something like this:
Here, you always read ahead from the last line in the file. So you do not have to look for the date either. You can initialize this to start from the first line in the file by entering "1" in the test.line file or start from the current state by entering the current 'number of lines' in the test.line file.
Please test this before putting in a production env.
Hello!
I'm using a perl script which calls the time and
date from a remote server using the line
/bin/date -
What is needed in this line to
reduce the output time
5 hours?
Thanks (2 Replies)
I am trying to write a script that will remove any line in 2 given text files
starting with '-'.
the output should be to the second file.
this is what I tried:
#!/bin/csh -f
cat $1 $2 | grep -v '^-' > $2
the problem is the after executing the script, file2 contains only the
lines from... (7 Replies)
Every day a new .zip file is uploaded to a folder and at mid-night the zip file is to be extracted into a /data/ folder, inside a date-named folder.
# This should extract the contents of a zip file into the /data/ folder into a date based folder
/usr/bin/unzip -a -o... (15 Replies)
Hi Frens,
I want to list some files from a directory, which contains "DONE" in their name, i am receiving files every minute. In this i want to list all the files which are newer than 6 hours but older than 3 hours, of current time
i dont want my list to contain the latest files which are ... (4 Replies)
This is Input - starts with Storage Group Name and ends with Shareable and the loop continues all I need is Storage group name and Alu numbers in the below output format requested.
Storage Group Name: abcd
Storage Group UID: 00:00:000:00:0:0:0
HBA/SP Pairs:
HBA UID ... (6 Replies)
Hi Guys,
Good day! I hope you could help me on this, I have a file that conatins output upon executing cat /var/log/messages, then what I want is to get the logs that has been generated only starting from 24-hours earlier at the time of actual execution of the script. Is this possible?
Best... (9 Replies)
Hi All,
Actually we want to know the command need to use if the difference between two files are null, then it should not send as mail. Oterwise it should send as mail alert.
Below for your reference,
# Email the spoolfile.
diff free_sp_new.log free_sp_old.log
if output of above... (1 Reply)
been messing around with linux for a few months...not too good yet. thinking about taking a class or something, this #### is hard.......anyway, im trying to make an output file using the input from a prompt. heres basically what i have now (random example)
echo -n "Please enter your name: "
read... (7 Replies)
Hi all,
I am trying to loop through the string contents of an array, to add it during the saving of the output files. I am trying this code to print each column and save it to unique file name, but it doesn't work. Thanks for any help.
fnam=(japan usa uk)
alldata.dat contained sample data... (1 Reply)
Discussion started by: ida1215
1 Replies
LEARN ABOUT DEBIAN
devel::trace
Trace(3pm) User Contributed Perl Documentation Trace(3pm)NAME
Devel::Trace - Print out each line before it is executed (like "sh -x")
SYNOPSIS
perl -d:Trace program
DESCRIPTION
If you run your program with "perl -d:Trace program", this module will print a message to standard error just before each line is executed.
For example, if your program looks like this:
#!/usr/bin/perl
print "Statement 1 at line 4
";
print "Statement 2 at line 5
";
print "Call to sub x returns ", &x(), " at line 6.
";
exit 0;
sub x {
print "In sub x at line 12.
";
return 13;
}
Then the "Trace" output will look like this:
>> ./test:4: print "Statement 1 at line 4
";
>> ./test:5: print "Statement 2 at line 5
";
>> ./test:6: print "Call to sub x returns ", &x(), " at line 6.
";
>> ./test:12: print "In sub x at line 12.
";
>> ./test:13: return 13;
>> ./test:8: exit 0;
This is something like the shell's "-x" option.
DETAILS
Inside your program, you can enable and disable tracing by doing
$Devel::Trace::TRACE = 1; # Enable
$Devel::Trace::TRACE = 0; # Disable
or
Devel::Trace::trace('on'); # Enable
Devel::Trace::trace('off'); # Disable
"Devel::Trace" exports the "trace" function if you ask it to:
import Devel::Trace 'trace';
Then if you want you just say
trace 'on'; # Enable
trace 'off'; # Disable
TODO
o You should be able to send the trace output to the filehandle of your choice.
o You should be able to specify the format of the output.
o You should be able to get the output into a string.
We'll see.
LICENSE
Devel::Trace 0.11 and its source code are hereby placed in the public domain.
Author
Mark-Jason Dominus (C<mjd-perl-trace@plover.com>), Plover Systems co. See the C<Devel::Trace.pm> Page at
http://www.plover.com/~mjd/perl/Trace for news and upgrades.
perl v5.14.2 2012-02-16 Trace(3pm)