Hi,
My requirement is like this:
I have a file with the following data
ABC=01-01-1900
EFG=01-01-1901
xyz=01-01-1900
I want to write a script which will replace the 01-01-1900 that correspond to the ABC to be replaced with a new date string like '06-21-2007 02:12:33'.
I tried a sed command like this sed -n 's/${SRC}/${VALUE}/gp' FILE.txt
But it is not working..
Please help me on this
Use double quotes instead of single quotes. Single quotes prevent the expansion of the variables.
Regards
Hi,
My requirement is like this:
I have a file with the following data
ABC=01-01-1900
EFG=01-01-1901
xyz=01-01-1900
I want to write a script which will replace the 01-01-1900 that correspond to the ABC to be replaced with a new date string like '06-21-2007 02:12:33'.
I tried a sed command like this sed -n 's/${SRC}/${VALUE}/gp' FILE.txt
But it is not working..
Please help me on this
Thanks Franklin..
I tried the command like this now
sed -n "s/${VALUE}/${TIME}/gp" $FILE.txt.
But it gives me an error like this now
sed: command garbled: s/01-01-1900/
Lose the single quotes they prevent expansion of the variables
sed -n "s/${SRC}/${VALUE}/gp" FILE.txt