I was wondering if you could help me with a replacement script im trying here…
I’ve got something like this:
aaaaaa,aaaaa,aaaaa,aaaa,aaaaa,aaa,aaa,aaa,aaaa,aaa
aaaa,aaaaa,aaaaa,aaaaaaa,aaa[1,2], aaaaaaaa[5,6], aaaa,aaaaaaa
and want to order the file to get something like:
aaaaaa,
aaa,
aaaaa,
aaaaa[1,2],
aaaaaaaa[5,6],
aaaaa,
aaaaaaaa,
aaaa
I’ve tried replacing , with line-breaks, but it separates the [n,n] blocks, too.
Also tried replacing ,[^0-9] with line-breaks, but I loose the first char after the comma.
I’ve been trying sed, but I’m not sure how this would look like.
I’ve added a sample of the file:
x0.fieldB [1,2] ,x5.fieldC ,x0.fieldX ,x0.fieldA
(x0.fieldE [1,5] = x2.fieldZ) ) AND (x0.fieldG [1,2] = x3.fieldT ) )
and should get something like this:
x0.fieldB [1,2] ,
x5.fieldC ,
x0.fieldX ,
x0.fieldA (x0.fieldE [1,5] = x2.fieldZ) ) AND (x0.fieldG [1,2] = x3.fieldT ) )
In order to not lose that digit, you need to capture it with (escaped) parenthesis, and then substitute it with
\1as follows: