Sort by custom alphabet
Bash+coreutils, 37 bytes
tr ,$2 \\na-z<<<$1|sort|tr \\na-z ,$2
Output:
$ ./alphasort.sh home,oval,cat,egg,network,green bcdfghijklmnpqrstvwxyzaeiouy
cat,green,home,network,egg,oval, $
CJam, 26 19 17 bytes
rr:A;',/{Af#}$',*
Try it online.
Test case
$ cjam sort.cjam <<< 'home,oval,cat,egg,network,green bcdfghjklmnpqrstvwxzaeiouy'
cat,green,home,network,egg,oval
How it works
rr " Read two whitespace-separated tokens from STDIN. ";
:A; " Save the second token (the alphabet) in A. ";
',/ " Split the remaining token at commas. ";
{Af#}$ " Sort by the chunks' characters' indexes in A. ";
',* " Join, separating by commas. ";
Pyth, 19 characters
j\,o_mx_zdNchczd\,
Test:
$ pyth -c "j\,o_mx_zdNchczd\," <<< 'home,oval,cat,egg,network,green bcdfghjklmnpqrstvwxzaeiouy'
cat,green,home,network,egg,oval
Explanation:
Implicit: d=" "
Implicit: z=input()
j\, ",".join(
o order_by(lambda N:
_ rev(
m map(lambda d:
x_zd rev(z).index(d),
N N),
chczd\, z.split(" "[0].split(",")
Essentially, it sorts the chunks, with a key of the list of indexes of the characters in the string, then joins them on commas. The reversal businesses is shorter than spliting the string again.