Code:
sed 's/^.*\(.\)$/\1/'
This regular expression uses a substring, between '\(' and '\)', to denote the last single character of the line in the search string. The replace string refers to the (first) substring with '\1' and so replaces the initial string with only the last character.
Note that
means a line with only one or none characters because the '^' used in this way means 'beginning of line'. To reverse a charactermatch use
which in this example doesn't do anything because it is searching for something thats not a character and not an 'end of line'.
Regards