Hi, Unix Gurus,
I have a requirement as following:
my file format as following:$Da=acc $Dc=ccc $C=0100 $$wc=1030 $$ldate=2000-01-01 00:00:00file b
2011-01-01 00:00:00I need a script to replace $$ldate from 2000-01-01 00:00:00 to the date from b file.
any body has some idea
thanks in advance
This awk script using an equal sign as a field seperator accepts the date time variable as variable v1 and replaces the second field if the comparison is correct. I leave reading the variable from file b into a variable to you:
#!/bin/ksh var="2011-01-01 00:00:00" awk ' BEGIN { OFS=FS="=" } { if($1 == "$$ldate") $2=v1 print $0 } ' v1="$var" filea
Thanks Nails This script works perfectly
Yes (14) | ![]() | |
No (14) | ![]() | |
I don't know (15) | ![]() |