I have a *.csv files in a die /pro/lif/dow, (pipe delimiter file), these files are having 8 columns and 6 column(CDR_LOGIC) records are populated as below, I need to incorporate the below logic in all the *.csv files.
11||:ColumnA||:ColumnB
123||:ColumnA
IIF(:ColumnA = :ColumnC then :ColumnD else :ColumnF)
Decode(:ColumnA, When :columnA = '123' then :columnF,
when :Column A = '1234' then :Column T END)
I have to create a new records based on the semi colon value i.e if the cdr_logic is having more than one semi colon the entire records should be copied in the next line as below.
No way we can do this in unix,you can capture the occurrences of semicolon but if you need to use as variables it can be difficult may be you can load the data in a database and write some procedural language to do this task.
x
s/.*//
x
s/:/;/
/:/{
: label
H
s/:/;/
t label
g
}
the output will be ; separated instead of : separated, you can replace that using another sed... or in same, but I guess this will solve the core issue.