LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 12-21-2005, 09:06 AM   #1
LULUSNATCH
LQ Newbie
 
Registered: Nov 2005
Location: Belgium
Distribution: Slackware 10.1 - Suse 9.1
Posts: 4

Rep: Reputation: 0
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
 
Old 12-21-2005, 09:20 AM   #2
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 52
What about this:

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

Will print
87654321
 
Old 12-21-2005, 09:29 AM   #3
LULUSNATCH
LQ Newbie
 
Registered: Nov 2005
Location: Belgium
Distribution: Slackware 10.1 - Suse 9.1
Posts: 4

Original Poster
Rep: Reputation: 0
Thanks

and for the line:

Disk Identifier : disk0s10

I want to grab the last word 'disk0s10'

thanks

lulu
 
Old 12-21-2005, 09:31 AM   #4
kshkid
Member
 
Registered: Dec 2005
Distribution: RHEL3, FC3
Posts: 383

Rep: Reputation: 30
Code:
echo "Disk Identifier : disk0s10" | sed -e 's/^.*://'
 
Old 12-21-2005, 09:33 AM   #5
LULUSNATCH
LQ Newbie
 
Registered: Nov 2005
Location: Belgium
Distribution: Slackware 10.1 - Suse 9.1
Posts: 4

Original Poster
Rep: Reputation: 0
Thanks

have a nice day
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sed Command : Line Start with benjagol Linux - Newbie 2 05-31-2005 02:28 AM
sed error message: extra characters after the command. nano_mag Linux - General 3 05-15-2005 01:00 AM
51 characters only in the 1st Line of command line eggCover Linux - General 2 07-29-2004 01:28 PM
using sed to grab two characters? nausicaa3000 Programming 4 04-20-2004 11:01 AM
Insert character into a line with sed? & variables in sed? jago25_98 Programming 5 03-11-2004 06:12 AM


All times are GMT -5. The time now is 04:24 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration