Home Man
Search
Today's Posts
Register

Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

Replace a value in the file that start with quotes

Tags
advanced

Login to Reply

 
Thread Tools Search this Thread
# 1  
Old 06-20-2012
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.

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

Thanks
Chand

Last edited by Scrutinizer; 06-25-2012 at 04:26 PM.. Reason: code tags
# 2  
Old 06-20-2012
And what output do you want from that?
# 3  
Old 06-25-2012
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.
# 4  
Old 06-25-2012
Yes, but what output do you want? Show it, don't just describe it.
# 5  
Old 06-25-2012
Old value in the file --->
Code:
"PADWD"\1\"LL9@99V@N=3M0O4I4;J43KH6"

New encrypted value taken as input -
Code:
LL9@99V@N=34566666

Expected output-
Code:
"PADWD"\1\"LL9@99V@N=34566666"

. Please help.

Last edited by Scrutinizer; 06-25-2012 at 04:27 PM..
# 6  
Old 06-26-2012
Code:
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

The Following User Says Thank You to Corona688 For This Useful Post:
chandu123 (06-26-2012)
# 7  
Old 06-26-2012
Thank you..Code worked..

-Chandra..
The Following User Says Thank You to chandu123 For This Useful Post:
Corona688 (06-26-2012)
Login to Reply

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Replace space within quotes SkySmart Shell Programming and Scripting 2 11-14-2017 02:12 AM
Replace semicolon within double quotes in a file with semicolon delimiter sam99 Shell Programming and Scripting 3 03-11-2016 01:23 AM
Replace Double quotes within double quotes in a column with space while loading a CSV file mlavanya Shell Programming and Scripting 6 05-12-2015 12:05 AM
Replace delimeter between quotes with \| using sed or awk BrahmaNaiduA Shell Programming and Scripting 4 05-04-2015 04:55 PM
How can I replace the lines that start with a star and replace it with numbers start from 1? aalbazie UNIX for Dummies Questions & Answers 7 11-10-2014 08:29 AM
HELP with AWK or SED. Need to replace the commas between double quotes in CSV file shell_boy23 Shell Programming and Scripting 5 07-12-2012 04:54 AM
Search replace strings between single quotes in a text file Hiano Shell Programming and Scripting 7 07-15-2011 10:35 AM
How to replace double quotes in to ascii value? rajesh4851 UNIX for Dummies Questions & Answers 4 05-11-2011 03:27 AM
sed replace spaces between quotes with a variable EXT3FSCK Shell Programming and Scripting 3 03-07-2010 12:22 AM
replace value with double quotes of specific coulmn value in csv file techmoris Shell Programming and Scripting 3 08-03-2009 09:37 PM


All times are GMT -4. The time now is 07:51 PM.

Unix & Linux Forums Content Copyrightę1993-2018. All Rights Reserved.
UNIX.COM Login
Username:
Password:  
Show Password