Find and Replace fields in a column of a CSV file
Posted: 27 Oct 2015 08:49
Hi Team,
I have a requirement where I need to change some of the values of a column of a file. I want SALE to be changed as SELL and PURCHASE to be changed as BUY only in a specific column. Please find my input file and desired output file for clear understanding of my requirement. Please suggest me a batch script that can perform this task. I want the output to be a new file. Thanks a lot.
Input File
Desired Output File
I have a requirement where I need to change some of the values of a column of a file. I want SALE to be changed as SELL and PURCHASE to be changed as BUY only in a specific column. Please find my input file and desired output file for clear understanding of my requirement. Please suggest me a batch script that can perform this task. I want the output to be a new file. Thanks a lot.
Input File
Code: Select all
"ABC","SALE","08/13/2015","08/18/2015","-15000.00","GLOBAL SALE","FIXED INCOME - SALE"
"TITAN","PURCHASE","08/12/2015","08/17/2015","55000.00","LOCAL PURCHASE","FIXED INCOME - PURCHASE"
"HUN","SHORT PURCHASE","08/12/2015","08/17/2015","60000.00","GLOBAL SHORT PURCHASE","FIXED INCOME - SHORT PURCHASE"
"WMB","PURCHASE","08/13/2015","08/18/2015","5000.00","GLOBAL PURCHASE","FIXED INCOME - PURCHASE"
"","SHORT SALE","08/13/2015","08/14/2015","-89235.90","LOCAL SHORT SALE","FIXED INCOME - SHORT SALE"
"XYZ","SALE","08/13/2015","08/18/2015","-633.00","GLOBAL SALE","FIXED INCOME - SALE"
Desired Output File
Code: Select all
"ABC","SELL","08/13/2015","08/18/2015","-15000.00","GLOBAL SALE","FIXED INCOME - SALE"
"TITAN","BUY","08/12/2015","08/17/2015","55000.00","LOCAL PURCHASE","FIXED INCOME - PURCHASE"
"HUN","SHORT PURCHASE","08/12/2015","08/17/2015","60000.00","GLOBAL SHORT PURCHASE","FIXED INCOME - SHORT PURCHASE"
"WMB","BUY","08/13/2015","08/18/2015","5000.00","GLOBAL PURCHASE","FIXED INCOME - PURCHASE"
"","SHORT SALE","08/13/2015","08/14/2015","-89235.90","LOCAL SHORT SALE","FIXED INCOME - SHORT SALE"
"XYZ","SELL","08/13/2015","08/18/2015","-633.00","GLOBAL SALE","FIXED INCOME - SALE"