Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: System Command using Bash Expansion

by eye (Chaplain)
on Mar 30, 2014 at 03:22 UTC ( [id://1080261]=note: print w/replies, xml ) Need Help??


in reply to System Command using Bash Expansion

I like a Perl solution:
#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my @result = ( '' ); my @plan = ( [ qw/ CAT CAC / ], [ qw/ TGG / ], [ qw/ GTT GTC GTA GTG / ], [ qw/ CCT CCC CCA CCG / ], ); for my $step ( @plan ) { my @new_result; for my $suffix ( @$step ) { push @new_result, map { "$_$suffix" } @result; } @result = @new_result; } print Dumper(\@result);
though I was surprised that bash's (4.1.2) echo would do what you want:
#!/bin/bash echo {CAT,CAC}TGG{GTT,GTC,GTA,GTG}{CCT,CCC,CCA,CCG}

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1080261]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2024-04-24 01:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found