sandeepmur
Programmer
Hi,
I am trying to alter a value in a file with awk.. I am almost there but hving some trouble..
echo $LOCK returns the value "LOCKED" correctly but the file is not altered.. what am i missing here ?
TIA,
I am trying to alter a value in a file with awk.. I am almost there but hving some trouble..
Code:
LOCK=`cat config/comp.cfg | awk '($2==X || substr($1,2)==X) && $0!="" && substr($1,0,1)!="#" {
str=$5;
sub(/-/, "LOCKED", str) <-- this line is supposed to work!
} END {print str}' X="$1"`
TIA,