Hello,
I have a large list of names and would like to do a reverse sort on them i.e. the sort should be by the ending and not by the beginning of the word.
I had written in awk a small script but it does wrong things
AWK
function reverse(s)
{
p = ""
for(i=length(s); i > 0; i--) { p = p substr(s, i, 1) }
return p
}
BEGIN {
print reverse("edoCattesoR")
}
Recursive
function reverse(s ,l)
{
l = length(s)
return l < 2 ? s:( substr(s,l,1) reverse(substr(s,1,l-1)) )
}
BEGIN {
print reverse("edoCattesoR")
}