Sed with sort doesnt work

Sed with sort doesnt work

The below code doesnt work:

sed -e '/^$/d' -e 's/,/|/g' | sort -t"|" -k1,1 -u file1

when i seperate them it work but i have to create intermediate file which i dont want to:

sed -e '/^$/d' -e 's/,/|/g'  file1 > file2
sort -t"|" -k1,1 -u file2

Help is appreciated

I think your initial sed command is still waiting for input

sed -e '/^$/d' -e 's/,/|/g' | sort -t"|" -k1,1 -u file1

maybe?

sed -e '/^$/d' -e 's/,/|/g' file1 | sort -t"|" -k1,1 -u >file2

You gave the file to sort instead of to sed.

sed -e '/^$/d' -e 's/,/|/g' file1 | sort -t"|" -k1,1 -u