Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pattern decomposition

Status
Not open for further replies.

opert

Technical User
May 4, 2011
6
Hello,

I have patterns like this:

Code:
0100100110010001

I would like to break up this and should get the following patterns:
Code:
0000100110010001
0100000010010001
0100100100000001
0100100110010000
So you can imagine the original one as blocks of 4's

Code:
0100 1001 1001 0001

and I should leave every blocks once (in a permutation way so that consider the empty block as being 0's everywhere).

Can anyone help me to solve this?

 
something like this ?
Code:
awk '{for(i=1;i<length;i+=4)print substr($0,1,i-1)"0000"substr($0,i+4)}' /path/to/patterns

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top