Use this template:
sed -r 's/(^.*\s)([0-9][0-9][:][0-9][0-9]:[0-9][0-9])(.*$)/\2/'
Here is an example:
echo "Nov 12 19:56:52 libra kernel" | sed -r 's/(^.*\s)([0-9][0-9][:][0-9][0-9]:[0-9][0-9])(.*$)/\2/' => 19:56:52
If you just want to print the entire contents of the file using sed, you can do this using:
sed r FILE
If you want sed to act like grep :
sed -n '/regexp/p' FILE
Or if you want it to act like grep -v
sed -n '/regexp/!p' FILE
You can also find a number of sed liners here (in fact, the above grep examples were taken from the webpage linked here - except that I added FILE for each of them)
source share