Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fileIn = new FileInputStream("data/config.csv")
- fileOut = new PrintStream("output/seb.csv")
- lst = []
- while(true) {
- buf = fileIn.read()
- if(buf == -1) {
- break
- } else {
- lst.add((char)buf)
- }
- }
- strBuf = ""
- lst.each { strBuf += it }
- lines = strBuf.split("\n")
- lst = []
- lst.add(["","CA913426 ","20111207.2","REALKREDIT DANMARK A/S 7% OBL. 1996/2029-10-01 SER.23", "DDK0009258022","VPDKDKKK","VPD","BANKRUPTCY","\"NOTIFICATION, COMP\"","NEWM","VOLU","2012-01-20","2012-01-20","2012-01-20","2012-01-20","2012-01-20","2012-01-20 12:00:00","2012-01-20","12:30","2012-01-20","2012-01-20 - 2012-01-21","2012-01-20 - 2012-01-21","2012-01-20 - 2012-01-21","1000","100","500","250","10.45","1000","2.45","EUR","IE1234567891","Inter Sec","New Sec","IE1234567892","CA000012","CASH"])
- lines.each { lst.add(it.split(",")) }
- for(i in 1..lst.size()-1) {
- strBuf = ""
- for(j in 1..lst[i].size()-1) {
- if(lst[i][j] == "x") {
- lst[i][j] = lst[0][j]
- }
- strBuf += lst[i][j] + ","
- }
- fileOut.write(strBuf[0..-2] + "\n")
- }
Advertisement
Add Comment
Please, Sign In to add comment