Thursday 10 June 2021

Groovy Script for removing the first two line from the csv/flat file in SCI/CPI/HCI

 Groovy script to remove first two lines from the string or csv file or flat file:


Remove first 2 lines:

import com.sap.gateway.ip.core.customdev.util.Message;
import java.util.HashMap;
import com.sap.it.api.mapping.*;
import java.text.SimpleDateFormat;
import java.util.Calendar;

def Message processData(Message message) {

def body = message.getBody(java.lang.String) as String;

def lines=body.split("\n").drop(2).join("\n")

message.setBody(lines)
return message;
}

Input:

1Bricks measurement 24/60cm
2Ravikumar
3RAmu
4Dinesh
5Vishnu
6Pradab

Output:

3RAmu
4Dinesh
5Vishnu
6Pradab


Take first two lines:













1 comment:

  1. cloud agnostic platform
    Cloud-based deployments of business applications is therefore on the rise for some very good reasons – it enhances business and technological agility, accelerates time to market and time-to-value and increases economies of scale.

    ReplyDelete