%TIME% | command is not the same thing as echo %TIME% | command. Without the echo, nothing gets fed into sed.
On my system, the date contains . too, so you you'd want to rip that out as well.
You can simplify your sed expression into -e "s/[:,.]//g"
You can't set variables in that fashion anyway. Windows CMD doesn't have backticks. It does have many strange options to SET and FOR some of which might be useful here.
---------- Post updated at 10:17 AM ---------- Previous update was at 10:10 AM ----------
'for' does have something like backticks but pipes don't work in it, and file redirection doesn't work outside of it...
---------- Post updated at 10:23 AM ---------- Previous update was at 10:17 AM ----------
I am using GnuWin32 sed and am having trouble with the regexp - i.e., they don't behave the same way as in UNIX (POSIX and and all that). I have a stream of data, e.g.:
11111'222?'22'33?'333'44444'55555'
I want to insert a \n after those apostrophes that are *not* preceded by a ?.
... (2 Replies)
Hi,
I am new to using Sed. I have a file containg lines like the following:
INFORM----Test.pc:168:10/11/05 12:34:26 > some text goes here..
TRACE-----Test.pc:197:10/11/05 12:34:26 > some text goes here..
My requirement is to replace 10/11/05 12:34:26 with a string <RUNDATE> (including <... (4 Replies)
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)
I installed the GnuWin32 tools on my Windows XP system but I cannot .. for the life of me .. get the SED tool to work for me.
All I need to do is remove blank lines for a text file. My script is ...
sed -e '/^$/ d' xxx.txt > yyy.txt
The error msg is: sed: -e expression #1, char 1: unknown... (1 Reply)
I want to instert Category:XXXXX into the 2. line
something like this should work, but I have somewhere the wrong sytanx. something with the linebreak goes wrong:
sed "2i\\${n}Category:$cat\n"
Sample:
Titel Blahh Blahh abllk sdhsd sjdhf
Blahh Blah Blahh
Blahh
Should look like... (2 Replies)
I have tried everything I can think of to get sed to change line N of a file to the contents of a variable. I have Googled the Internet, and I find lots of people telling how to use variables with the "Substitute" command, but no one telling how to use variables with the "Change" command.
I... (4 Replies)
Hello everyone,
i wonder if someone could give me an advice regarding the following problem using sed.
Given ist a structure as shown below:
<aaa>text1<b>text2</b>text3<c>text4</c>text5</aaa>
Now I want to change the outer tag from "aaa" to "new" and replace all tags inside the outer tags... (4 Replies)
Hi, I have the following command that parses an xml file to read a node <port>'s value. Hoever the output comes with spaces.
My requirement is to trim the spaces around the value and assign to a variable.
sed -n 's|<port>\(.*\)</port>|\1|p' ../cfg.xml
How do I go about it? (6 Replies)
I have a below syntax its working fine...
var12=$(ps -ef | grep apache | awk '{print $2,$4}')
Im getting expected output as below:
printf "%b\n" "${VAR12}"
dell 123
dell 456
dell 457
Now I wrote a while loop.. the output of VAR12 should be passed as input parameters to while loop and results... (5 Replies)
Discussion started by: sam@sam
5 Replies
LEARN ABOUT DEBIAN
schedule::at
At(3pm) User Contributed Perl Documentation At(3pm)NAME
Schedule::At - OS independent interface to the Unix 'at' command
SYNOPSIS
require Schedule::At;
Schedule::At::add(TIME => $string, COMMAND => $string [, TAG =>$string]);
Schedule::At::add(TIME => $string, COMMAND => @array [, TAG =>$string]);
Schedule::At::add(TIME => $string, FILE => $string)
%jobs = Schedule::At::getJobs();
%jobs = Schedule::At::getJobs(JOBID => $string);
%jobs = Schedule::At::getJobs(TAG => $string);
Schedule::At::readJobs(JOBID => $string);
Schedule::At::readJobs(TAG => $string);
Schedule::At::remove(JOBID => $string);
Schedule::At::remove(TAG => $string);
DESCRIPTION
This modules provides an OS independent interface to 'at', the Unix command that allows you to execute commands at a specified time.
Schedule::At::add
Adds a new job to the at queue.
You have to specify a TIME and a command to execute. The TIME has a common format: YYYYMMDDHHmm where YYYY is the year (4 digits), MM
the month (01-12), DD is the day (01-31), HH the hour (00-23) and mm the minutes.
The command is passed with the COMMAND or the FILE parameter. COMMAND can be used to pass the command as an string, or an array of
commands, and FILE to read the commands from a file.
The optional parameter TAG serves as an application specific way to identify a job or a set of jobs.
Returns 0 on success or a value != 0 if an error occurred.
Schedule::At::readJobs
Read the job content identified by the JOBID or TAG parameters.
Returns a hash of JOBID => $string where $string is the the job content. As the operating systems usually add a few environment
settings, the content is longer than the command provided when adding the job.
Schedule::At::remove
Remove an at job.
You identify the job to be deleted using the JOBID parameter (an opaque string returned by the getJobs subroutine). You can also
specify a job or a set of jobs to delete with the TAG parameter, removing all the jobs that have the same tag (as specified with the
add subroutine).
Used with JOBID, returns 0 on success or a value != 0 if an error occurred. Used with TAG, returns a hash reference where the keys are
the JOBID of the jobs found and the values indicate the success of the remove operation.
Schedule::At::getJobs
Called with no params returns a hash with all the current jobs or dies if an error has occurred. It's possible to specify the TAG or
JOBID parameters so only matching jobs are returned. For each job the key is a JOBID (an OS dependent string that shouldn't be
interpreted), and the value is a hash reference.
This hash reference points to a hash with the keys:
TIME
An OS dependent string specifying the time to execute the command
TAG The tag specified in the Schedule::At::add subroutine
Configuration Variables
o $Schedule::At::SHELL
This variable can be used to specify shell for execution of the scheduled command. Can be useful for example when scheduling from CGI
script and the account of the user under which httpd runs is locked by using '/bin/false' or similar as a shell.
EXAMPLES
use Schedule::At;
# 1
Schedule::At::add (TIME => '199801181530', COMMAND => 'ls',
TAG => 'ScheduleAt');
# 2
@cmdlist = ("ls", "echo hello world");
Schedule::At::add (TIME => '199801181630', COMMAND => @cmdlist,
TAG => 'ScheduleAt');
# 3
Schedule::At::add (TIME => '199801181730', COMMAND => 'df');
# This will remove #1 and #2 but no #3
Schedule::At::remove (TAG => 'ScheduleAt');
my %atJobs = Schedule::At::getJobs();
foreach my $job (values %atJobs) {
print " ", $job->{JOBID}, " ", $job->{TIME}, ' ',
($job->{TAG} || ''), "
";
}
AUTHOR
Jose A. Rodriguez (jose AT rodriguez.jp)
perl v5.14.2 2012-04-24 At(3pm)