Hi Team,
I have a requirement in such a way that need to split the file into two based on which column particular value appears.Please find my sample file below.
Lets consider the delimiter of this file as either comma or two colons.(:: and ,). So I need to split the file in such a way that all the records with value SRC1 in COL6 should go to one file and all the records with value SRC1 in COL5 should go to another file.
Note: The first line COL1,COL2...etc is not there in my actual file.I added it for a better reading for you guys
Input File
COL1 COL2 COL3 COL4 COL5 COL6 COL7 COL8 COL9 COL10 COL11 COL12
11/14/2018 14:03:12::SERVER::XXX::DUMMYSUB,SRC1,TARGET1::TKT::RB::TEST::WARNING::Inactive::DUMMYSUB
11/14/2018 14:03:12::SERVER::XXX::DUMMYSUB1,SRC1,TARGET1::TKT::RB::TEST::WARNING::Inactive::DUMMYSUB1
11/14/2018 14:03:12::SERVER::XXX::DUMMYSUB2,SRC2,SRC1::TKT::RB::TEST::WARNING::Inactive::SNID2PAD
11/14/2018 14:03:12::SERVER::XXX::DUMMYSUB3,SRC2,SRC1::TKT::RB::TEST::WARNING::Inactive::SNID2PAR
My output looks something like this.
Output File1
11/14/2018 14:03:12::SERVER::XXX::DUMMYSUB,SRC1,TARGET1::TKT::RB::TEST::WARNING::Inactive::DUMMYSUB
11/14/2018 14:03:12::SERVER::XXX::DUMMYSUB1,SRC1,TARGET1::TKT::RB::TEST::WARNING::Inactive::DUMMYSUB1
Output File2
11/14/2018 14:03:12::SERVER::XXX::DUMMYSUB2,SRC2,SRC1::TKT::RB::TEST::WARNING::Inactive::SNID2PAD
11/14/2018 14:03:12::SERVER::XXX::DUMMYSUB3,SRC2,SRC1::TKT::RB::TEST::WARNING::Inactive::SNID2PAR