Reputation: 1
I am using Rad tool (using .NET framework) and XML for parsing data file.
I am stuck with a particular row that has to be split into two. The format is: (# and afterwards is just to convey column and data)
Drive Name UNE Con Accessible by Drive status # column names
A L D 0 A,B Storage Subsystem Optimal # Data row 1
1 1 A Storage Subsystem Optimal # Data row 2
The first row:
A L D 0 A,B Storage Subsystem Optimal
Needs to be split in two rows in the format:
A L D 0 A Storage Subsystem Optimal
A L D 0 B Storage Subsystem Optimal
So that the one liner RE show the extracted data in the format:-
Drive Name UNE Con Accessible by Drive status
A L D 0 A Storage Subsystem Optimal
A L D 0 B Storage Subsystem Optimal
1 1 A Storage Subsystem Optimal
Upvotes: 0
Views: 165
Reputation: 21
Expecting tab as a delimiter between 2 columns.
$string =~ s/([a-zA-Z0-9]+)\t([a-zA-Z0-9 ]+)\t(([a-zA-Z0-9 ]+),([a-zA-Z0-9 ]+))\t([a-zA-Z0-9 ]+)\t([a-zA-Z0-9 ]+)/$1\t$2\t$4\t$6\t$7\n$1\t$2\t$5\t$6\t$7/gs
Upvotes: 2