Replace a value in the file that start with quotes


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Replace a value in the file that start with quotes
# 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 05: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 05: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

This User Gave Thanks to Corona688 For This Post:
# 7  
Old 06-26-2012
Thank you..Code worked..

-Chandra..
This User Gave Thanks to chandu123 For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replace space within quotes

i have an output that i receive and it looks like this: echo '/var/FTPROOT/px/sci/archive/20171102070057904-DY_DC04_Daily Inventory Sync-en-us.csv' '/var/FTPROOT/px/sci/archive/20171102070058291-DY_DC07_Daily Inventory Sync-en-us.csv' what i want to do is replace the spaces in the file names... (2 Replies)
Discussion started by: SkySmart
2 Replies

2. Shell Programming and Scripting

Replace semicolon within double quotes in a file with semicolon delimiter

Hello Team, Could you please help me with the below question? I have a file with the following properties 1) File Delimiter is ; 2) Text columns are within double quotes 3) Numeric columns will not have double quotes 4) File has total 6 columns Please see a sample record from file ... (3 Replies)
Discussion started by: sam99
3 Replies

3. Shell Programming and Scripting

Replace Double quotes within double quotes in a column with space while loading a CSV file

Hi All, I'm unable to load the data using sql loader where there are double quotes within the double quotes As these are optionally enclosed by double quotes. Sample Data : "221100",138.00,"D","0019/1477","44012075","49938","49938/15043000","Television - 22" Refurbished - Airwave","Supply... (6 Replies)
Discussion started by: mlavanya
6 Replies

4. UNIX for Dummies Questions & Answers

How can I replace the lines that start with a star and replace it with numbers start from 1?

I need to replace the (*) in the fist of a list with numbers using sed for example > this file contain a list * linux * computers * labs * questions to >>>> this file contain a list 1. linux 2. computers 3. labs 4. questions (7 Replies)
Discussion started by: aalbazie
7 Replies

5. Shell Programming and Scripting

Search replace strings between single quotes

Hi All, I need to serach and replace a strings between single quote in a file. My file has : location='/data1/test.log' and the output needed is location='/data2/test_dir/test.log' pls if anybody know this can be done in script sed or awk. I have a script, but it's... (6 Replies)
Discussion started by: mnmonu
6 Replies

6. Shell Programming and Scripting

HELP with AWK or SED. Need to replace the commas between double quotes in CSV file

Hello experts, I need to validate a csv file which contains data like this: Sample.csv "ABCD","I",23,0,9,,"23/12/2012","OK","Street,State, 91135",0 "ABCD","I",23,0,9,,"23/12/2012","OK","Street,State, 91135",0 I just need to check if all the records contain exactly the number of... (5 Replies)
Discussion started by: shell_boy23
5 Replies

7. Shell Programming and Scripting

Search replace strings between single quotes in a text file

Hi There... I need to serach and replace a strings in a text file. My file has; books.amazon='Let me read' and the output needed is books.amazon=NONFOUND pls if anybody know this can be done in script sed or awk.. i have a list of different strings to be repced by NONFOUND.... (7 Replies)
Discussion started by: Hiano
7 Replies

8. UNIX for Dummies Questions & Answers

How to replace double quotes in to ascii value?

Hi, I am getting the data from text file and it contains comma and double quootes. Eg: text file like this: Travelling up Cattai Ridge Rd, going through the "S" bends at the top. Felt a "pull" and pain in groin area, on right side after lifting at work. Repeat "twisting" while working manual... (4 Replies)
Discussion started by: rajesh4851
4 Replies

9. Shell Programming and Scripting

sed replace spaces between quotes with a variable

I have lines with: elseif (req.http.host ~ "^(www.)?edificationtube.com$|www.edificationtube.org www.edificationtube.net edificationtube.org www.edificationtube.com edificationtube.net") { elseif (req.http.host ~ "^(www.)?collegecontender.com$|www.collegecontender.com collegecontenders.com... (3 Replies)
Discussion started by: EXT3FSCK
3 Replies

10. Shell Programming and Scripting

replace value with double quotes of specific coulmn value in csv file

Hi, I am trying to replace a specific column values in a csv file with double quotes. Example: SNO,NAME,ZIPCODE,RANK 1,Robert,74538,12 2,Sam,07564,13 3,Kim, Ed,12345,14 Desired Output: SNO,NAME,ZIPCODE,RANK 1,Robert Ken,74538,12 2,Sam Mik,"07564",13 3,"Kim, Ed",12345,14 I... (3 Replies)
Discussion started by: techmoris
3 Replies
Login or Register to Ask a Question