finding the Last String in a Line

Hi,

i am looking for a command that can help me find the last Sting in a Line

ex.. [Thr 138] yyeyrtehhehrerry: change this from [Starting steps (10)] to [END (3)]

here i want to extract END.

$ echo "[Thr 138] yyeyrtehhehrerry: change this from [Starting steps (10)] to [END (3)]" | nawk awk -F'[' '{$0=$NF ; sub(/ .*/, "") } 1'
END
$

But that wouldn't work if the last string is not preceded by '['. E.g.:

$ echo 'ex.. [Thr 138] yyeyrtehhehrerry: change this from [Starting steps (10)] to END (3)]' | awk -F'[' '{$0=$NF ; sub(/ .*/, "") } 1'
Starting

How about this?

$ echo 'ex.. [Thr 138] yyeyrtehhehrerry: change this from [Starting steps (10)] to[END (3)]' | sed 's/[^[:alpha:]]/\n/g' | sed  '/^$/d'  | tail -n 1
END
# tested with bash 4 (regex 3.2+)
[[ $string =~  ([[:alpha:]]+).[^[:alpha:]]*$ ]]
echo ${BASH_REMATCH[0]% *}

Thanks Experts ,

don't know but it does not work , what is wrong here(ksh)

$ echo 'ex.. [Thr 138] yyeyrtehhehrerry: change this from [Starting steps (10)] to[END (3)]' | sed 's/[^[:alpha:]]/\n/g' | sed  '/^$/d'  | tail -n 1
usage: tail [+/-[n][lbc][f]] [file]
       tail [+/-[n][l][r|f]] [file]

All i want is LAST string of a line or may be a file

Thanks

Try this:

echo 'ex.. [Thr 138] yyeyrtehhehrerry: change this from [Starting steps (10)] to[END (3)]' | sed 's/[^[:alpha:]]/\n/g' | sed  '/^$/d'  | echo 'ex.. [Thr 138] yyeyrtehhehrerry: change this from [Starting steps (10)] to[END (3)]' | sed 's/[^[:alpha:]]/\n/g' | sed  '/^$/d'  | sed -n '$ p'

How do you define 'last string' in your universe? Because really, the whole input

'ex.. [Thr 138] yyeyrtehhehrerry: change this from [Starting steps (10)] to[END (3)]'

is a string. So what are you trying to extract? Last word consisting of letters only? Or last substring before space? Or last word (substring separated by spaces) consisting of at least one letter? Or something else last?
The above code works like this: the first sed command replaces all non-alphabet characters with a newline; the next sed command will delete the empty lines, and the last sed will print only the last line (which is the last blob of alphabet characters in the input).