Quote:
Originally Posted by smr_rashmy
Could you please explain me both when you find time?
hey its not working ya.
$ dt=`date -u +%d-%m-%y`
$
$ echo $dt
29-01-08
$
$ cat tst.txt
Date 12-01-08
$
$ awk -v dat=$dt -v '{if( $1 ~ /Date/) print $1" "dat;}' tst.txt
Usage: awk [-F fs][-v Assignment][-f Progfile|Program][Assignment|File] ...
$
$ sed -e 's/Date\(.*\)/Date '$dt'/' tst.txt
Date 29-01-08
$ cat tst.txt
Date 12-01-08
$
what is wrong with my command?
|
Why you have used -v there? Also, if you want these changes to written on to a file, you have to use "> new_filename" at the end...
ie,
sed -e 's/Date\(.*\)/Date '$dt'/' tst.txt > temp_new_file