in unix using simple command like sed how to print last character of a file?
feedback
|
migrated from stackoverflow.com Mar 3 '11 at 14:16
This question came from our site for professional and enthusiast programmers.
|
tail is the right tool, not sed.
| |||||
feedback
|
|
Try this | |||||||||||||||
feedback
|
|
Edit: If your file has a an end of life / eof character that you want to ignore, it's 2. 1 otherwise. | |||||||
feedback
|
|
This should work, provided that last line is not empty:
| |||
|
feedback
|
|
Use: where test is the name of your file. | ||||
|
feedback
|
|
this command will print the last character
| |||
|
feedback
|
