LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Getting last characters of a line with sed command (https://www.linuxquestions.org/questions/programming-9/getting-last-characters-of-a-line-with-sed-command-395254/)

LULUSNATCH 12-21-2005 09:06 AM

Getting last characters of a line with sed command
 
Hello,i'm a big newbie with Linux script

i want to grab last 8 characters of a line with the seb command?

Thanks for your help

lulu

nx5000 12-21-2005 09:20 AM

What about this:

echo "987654321" | sed -e 's/^.*\(........\)$/\1/'

Will print
87654321

LULUSNATCH 12-21-2005 09:29 AM

Thanks

and for the line:

Disk Identifier : disk0s10

I want to grab the last word 'disk0s10'

thanks

lulu

kshkid 12-21-2005 09:31 AM

Code:

echo "Disk Identifier : disk0s10" | sed -e 's/^.*://'

LULUSNATCH 12-21-2005 09:33 AM

Thanks

have a nice day


All times are GMT -5. The time now is 01:19 AM.