Replace a value in the file that start with quotes

I have to replace the specific encypted [LL9@99V@N=3M0O4I4;J43KH6] value in the file which is will be a taken as input from user always.PADWD appears two times in the document of which I need to replace the line which start with double quotes. Please help.

"PADWD"\1\"LL9@99V@N=3M0O4I4;J43KH6"---Sample line in the file.

Thanks
Chand

And what output do you want from that?

Once the value is inserted i will be running a related job for which I have tested command and is running fine. Please help me with insert code. Thank you.

Yes, but what output do you want? Show it, don't just describe it.

Old value in the file --->

"PADWD"\1\"LL9@99V@N=3M0O4I4;J43KH6"

New encrypted value taken as input -

LL9@99V@N=34566666

Expected output-

"PADWD"\1\"LL9@99V@N=34566666"

. Please help.

VAR="LL9@99V@N=34566666"
OLDIFS="$IFS"; IFS="="
set -- $VAR
IFS="$OLDIFS"

awk '/"PADWD"/ && ($0 ~ P1) { sub(/"[^="]*=[^"]*"$/, "\"" P1 "=" P2 "\""); } 1' P1=$1 P2=$2 inputfile > outputfile
1 Like

Thank you..Code worked..

-Chandra..

1 Like