sorting null values

Hi
I have a file with the values

abc
res

set
kls

lmn
ops

i want to sort this file with the null values at the bottom of the file

OUTPUT should look like this

abc
kls
lmn
ops
res
set
then the three NULL

Hello and welcome to the forums.

I cant be certain, because you didn't use code tags around you sample data, but the following solution assumes that those are empty lines (no spaces or tabs or other non-printing characters):

sort file | sed '/^$/{H;d;}; ${G;s/\n$//;}'

Regards,
Alister

Thanks Alister !
those are empty lines lets say that empty line contain tabs or space.
but i need those tab/space at the EOF.

Regards,
Vicky

sort myFile | nawk '!NF{e[++nf]=$0}; NF; END{while(++i in e) print e}'

Thanks
That works perfectly

sort  file   | sed '/^$/d' | sed -re '$s/(.*)/\1\n\n\n/'

Pardon the nitpick, but a line with spaces and tabs is not an empty line nor a null line. I mention it not to be pedantic but because using that wording to describe them is imprecise and may interfere with our abilitiy to deliver a quick and accurate solution. Non-empty blank lines is probably the most accurate term (isblank(3) returns true only for tab and space characters when using the standard C locale). The following solution handles empty lines (lines containing zero bytes) and lines consisting solely of any combination of blank characters.

sort file | sed '/^[[:blank:]]*$/{H;d;}; ${x;s/^\n//;x;G;}'

Cheers,
Alister