Computing.Net > Forums > Linux > SED - leaving last 3 characters

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

SED - leaving last 3 characters

Reply to Message Icon

Name: fmr1909
Date: March 30, 2005 at 10:18:33 Pacific
OS: SuSE 9
CPU/Ram: p iii 800 - 156 mb
Comment:

I am using sed in a script, and want to leave the last 3 caracters each line.

Lines may be like this:

45664551d67
r457
df rt1

and want to be like this:

d67
457
rt1

Is this posible using sed?

Thanks.



Sponsored Link
Ads by Google

Response Number 1
Name: David Perry
Date: March 31, 2005 at 05:31:56 Pacific
Reply:

It is likely possible. The answer would probably look something like this

echo "I have a red pencil box" | sed -e "s/.*\([^ ]\{3\}\)$/\1/"


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Linux Forum Home


Sponsored links

Ads by Google


Results for: SED - leaving last 3 characters

sed special characters www.computing.net/answers/linux/sed-special-characters/19365.html

Monitor Problems (XF86Config) www.computing.net/answers/linux/monitor-problems-xf86config/10848.html

sed -f: error www.computing.net/answers/linux/sed-f-error/27727.html