Thanks both of you.
My situation is:
In my first file abc contains one string '2011-01-01' (only on line), in my second file contains multiple lines, one of them is $$lastupdatedate=xxxx-xx-xx, I want replace xxxx-xx-xx with 2011-01-01 in second file and get $$lastupdatedate=2011-01-01.
the regex will match a line starting with '$$lastupdatedate', and replace the second field (stuff after equal sign) with the contents of $dateFile. '1' at the end is just a shortcut to print everything out.
---------- Post updated 06-23-11 at 10:51 AM ---------- Previous update was 06-22-11 at 09:10 PM ----------
Hi, Mirni,
Above scripts works fine when I tried on my laptop. But it give me error when I tested on my workstation.
awk: syntax error near line 1
awk: illegal statement near line 1
the system as following
$ uname -a
SunOS abc 5.10 Generic_144488-11 sun4v sparc SUNW,Sun-Fire-T200
Hi, Shamrock,
after changing to nawk, I got following errors.
nawk: can't open file OFS==inputfile
I removed OFS="=", but I got another error as following
:nawk: syntax error at source line 1
context is
/^\$\$lastupdatedate/ >>> {$2="2010-01-01 <<<
nawk: illegal statement at source line 1
any idea about this?
Thanks in advance.
another thing, is there any other way to achieve this purpose?