csvReader = new CSVReader(new BufferedReader(new FileReader(args[0])));
csvWriter = new CSVWriter(new BufferedWriter(new FileWriter(args[1])));
String[] line;
Pattern pattern = Pattern.compile("^(\\w\\w\\w).*?(\\d+)(M|Y)(\\d+)(M|Y)\\s*?(PY|RC)\\s*?(.*)$");
BloombergReferenceDataProvider rawBbgRefDataProvider = getBloombergSecurityFileLoader();
MongoDBValueCachingReferenceDataProvider bbgRefDataProvider = MongoCachedReferenceData.makeMongoProvider(rawBbgRefDataProvider, BloombergSwaptionFileLoader.class);
while ((line = csvReader.readNext()) != null) {
String name = line[NAME_FIELD];
Matcher matcher = pattern.matcher(name);
if (matcher.matches()) {
String ccy = matcher.group(1);
String swapTenorSize = matcher.group(2);
String swapTenorUnit = matcher.group(3);
String optionTenorSize = matcher.group(4);
String optionTenorUnit = matcher.group(5);
String payReceive = matcher.group(6);
String distanceATM = matcher.group(7);
String buid = "/buid/" + line[BUID_FIELD];
String value = bbgRefDataProvider.getReferenceDataValue(buid, "TICKER");
csvWriter.writeNext(new String[] {name, ccy, swapTenorSize, swapTenorUnit, optionTenorSize, optionTenorUnit, payReceive, distanceATM, value });
} else {
s_logger.error("Couldn't parse " + name + " field");
}