Hi,
I posted in this site after working a lot on this file.But i forgot to post wat i have tried.
I tried matching the pattern separating with - with the following
grep "[[:alnum:]].\+-.\+[[:alnum:]].\+-.\+[[:alnum:]].\+-.*" test.csv > cat>p.csv
my input file
Time,SubnetMask,ScopeName,percentFree,TotalDynamic,TotalReserved,Leased,Avail,otherAvail,PendingAvail,InTransition,ReservedActive,Unavail,ActiveDeactivated,Deactivated
20131203170000,171.99.192.0/23,SRT-PKT-ActiveSubCPE-13,87,509,0,66,399,44,0,0,0,0,0,0,
20131203170000,10.18.32.0/20,MSKKBK13CM0-ActiveSubCM-01,35,3578,0,2300,1144,127,0,7,0,0,0,0,
20131203170000,110.169.128.0/23,SKW-09-ActiveSubCPE-01,0,504,0,504,0,0,0,0,0,0,0,0,
20131203170000,10.18.32.0/20,MSKKBK13CM0-BZ-ActiveSubCM-01,100,248,0,0,224,24,0,0,0,0,0,0,
20131203170000,10.18.32.0/20,Total,39,3826,0,2300,1368,151,0,7,0,0,0,0,
20131203170000,10.18.48.0/20,BNA-ActiveSubCM-02,81,4090,0,774,2982,331,0,3,0,0,0,0,
20131203170000,171.98.202.0/23,SKW-09-ActiveSubCPE-08,41,509,0,300,188,21,0,0,0,0,0,0,
20131203170000,10.18.48.0/20,Total,81,4090,0,774,2982,331,0,3,0,0,0,0,
20131203170000,10.18.64.0/20,SMSSBK01CM0-BZ-ActiveSubCM-01,100,504,0,0,454,50,0,0,0,0,0,0,
20131203170000,10.18.64.0/20,SMSSBK01CM0-ActiveSubCM-01,76,3576,0,834,2467,274,0,1,0,0,0,0,
20131203170000,171.99.150.0/23,SRT-PKT-ActiveSubCPE-07,0,509,0,509,0,0,0,0,0,0,0,0,
20131203170000,171.99.186.0/23,SKW-09-ActiveSubCPE-04,0,509,0,507,2,0,0,0,0,0,0,0,
20131203170000,171.99.172.0/23,Total,25,509,0,380,114,14,0,1,0,0,0,0,
20131203170000,171.99.174.0/23,PNC-ActiveSubCPE-05,47,509,0,269,216,24,0,0,0,0,0,0,
20131203170000,171.99.174.0/23,Total,47,509,0,269,216,24,0,0,0,0,0,0,
this matches the pattern [anything]-[anything]-[anything]-[someinteger]
and output those lines to p.csv
executed output
20131203170000,58.10.152.0/23,SRT-PKT-ActiveSubCPE-13,87,509,0,66,399,44,0,0,0,0,0,0,
20131203170000,171.99.150.0/23,SRT-PKT-ActiveSubCPE-07,0,509,0,509,0,0,0,0,0,0,0,0,
But i wanted the output in such a awy that
those two lines should be merged intio one single line with the fields from field number 4 added,field number 2 appended and the scope name as SRT-PKT-ActiveSubCPE
without succeeded by integer
i wonder why its not giving me the output with the lines matching pattern SKW-09-ActiveSubCPE
Required output
20131203170000,58.10.152.0/23+171.99.150.0/23,SRT-PKT-ActiveSubCPE,87,1018,0,575,399,44,0,0,0,0,0,0
Thanks in advance
Regards,
Preethy