Generate permutations from multiple fields (not using Python) -
i'm trying simply, using regular unix functions (that understand), , not python (i think itertools possibly me there ?) don't understand. so: several small lists of inputs (separated commas), need used generate possible permutations. example:
list 1: (i, you, we)
list 2: (want eat, want buy, want steal)
list 3: (a banana, hamburger, icecream)
so there 3 x 3 x 3 = 27 possible outputs, are:
i want eat banana
i want eat hamburger
... , on
i'm pretty sure there no 1 liner this, there simple way achieve using simple unix building blocks ?
while not technically shell commands, bash script can pretty nested loops.
#!/bin/bash list1=("i" "you" "we") list2=("want eat" "want buy" "want steal") list3=("a banana" "a hamburger" "an icecream") in "${list1[@]}"; j in "${list2[@]}"; k in "${list3[@]}"; echo $i" "$j" "$k done done done
Comments
Post a Comment