![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Compare date from db2 table to yesterday's Unix system date | sasaliasim | Shell Programming and Scripting | 9 | 3 Days Ago 08:37 PM |
| Perl: Extracting date from file name and comparing with current date | MKNENI | Shell Programming and Scripting | 4 | 03-26-2008 01:01 PM |
| date issue-find prevoius date in a patricular format | bsandeep_80 | UNIX for Advanced & Expert Users | 3 | 11-15-2007 05:42 PM |
| Changing Creation Date to a Prespecified Date of a File In Unix | monkfan | UNIX for Dummies Questions & Answers | 4 | 11-28-2006 04:15 AM |
| a simple way of converting a date in seconds to normal date | travian | HP-UX | 2 | 11-23-2006 09:25 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
sed, date and /&
Hi,
Code:
$ echo 1 titi | sed -e "s/1/$(echo \&)/" 1 titi Code:
$ echo 1 titi | sed -e "s/1/$(date \&)/" date: invalid date `&' titi Thx |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
What exactly are you trying to achive with this code?
|
|
#3
|
|||
|
|||
|
Use case is not important, this is just one example.
I just wanna use the seed replacement special character & with the date command, like with echo. |
|
#4
|
|||
|
|||
|
You are passing an invalid argument to the date utility as in "date 1", hence the error.
Code:
$ echo 1 titi | sed -e "s/1/$(date \&)/"
date: illegal time format
usage: date [-ajnu] [-d dst] [-r seconds] [+format]
date -b [-ajnu] [-d dst] [-t west] [+format] [[[[[[cc]yy]mm]dd]HH]MM[.SS]
date [-ajnu] [-d dst] [-t west] [+format] [mmddHHMM[[cc]yy]]
titi
|
|
#5
|
|||
|
|||
|
fpmurphy, thx for the reply.
With a good argument, that still doesn't work for me. Code:
echo 01201300 titi | sed -e "s/01201300/$(date \&)/" date: invalid date `&' titi |
|
#6
|
||||
|
||||
|
Do you want an output line this?
Code:
$ echo 08150000 titi | sed "s/08150000/$(date &)/" Fri Aug 15 00:00:08 WEDT 2008 titi Last edited by radoulov; 01-20-2008 at 07:07 AM. |
|
#7
|
||||
|
||||
|
sncr24, your question does not make sense. That's why we cannot answer it.
Code:
$ echo 1 titi 1 titi $ echo 1 titi | sed "s/1/&/" 1 titi Code:
$ echo 1 titi | sed -e "s/1/=&=&=/" =1=1= titi $ Code:
$ echo 1 titi | sed -e "s/1/$(echo \&)/" 1 titi echo \& date +\& both output a single ampersand. So both Code:
echo 1 titi | sed -e "s/1/$(echo \&)/" echo 1 titi | sed -e "s/1/$(date +\&)/" I do not know what you are try to do, but I hope this helps move you toward fufilling your requirements. (Whatever they may be...) |
||||
| Google The UNIX and Linux Forums |