Pages

Friday, September 9, 2022

transposing delimited values using GREP only


 ok so this is silly but I don't care, because as recently as a month ago it was stupid hard, & then *poof* a way to do it popped into my little head.

how to

TRANSPOSE

with nothing but

GREP




transpose tab delimited values of 7 columns 200 rows


PREP:

number rows w/ a tab after the number


format:

<STEP #>

<GREP>

<REPLACE>


<1>

<GREP>

^([0-9]+)\t(.?)\t(.?)\t(.?)\t(.?)\t(.?)\t(.?)\t(.?)

<REPLACE>

A\1\t\2\rB\1\t\3\rC\1\t\4\rD\1\t\5\rE\1\t\6\rF\1\t\7\rG\1\t\8\r\r


<2>

<GREP>

(.)99\t.\r(.)99\t.\r(.)99\t.\r(.)99\t.\r(.)99\t.\r(.)99\t.\r(.)99\t.\r+\Z

<REPLACE> 

\1\99100\t@\r\2\99100\t@\r\3\99100\t@\r\4\99100\t@\r\5\99100\t@\r\6\99100\t@\r\7\99100\t@\r


<3>

<GREP>

\r[A-Z].*?\t

<REPLACE W/ NOTHING>


<4>

<GREP> 

@

<REPLACE W/ NEWLINE>

\r



Be seeing. you.



No comments:

Post a Comment