%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 know. The closest CMD has to backticks is FOR though, which only has one way to run an external command, doesn't support redirection or pipes inside it, and doesn't support redirection or pipes outside it. If sed would accept a string from the commandline instead of stdin, it'd be possible.
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)
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)
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)
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)
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 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)
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)
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)
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)