[lug] delete last character of every line

Ron Wright halsaves at gmail.com
Wed Mar 23 16:18:23 MST 2005


A little more specific (since "." is a wild card):

sed 's/\.$//'


On Wed, 23 Mar 2005 15:58:49 -0700, Zan Lynx <zlynx at acm.org> wrote:
> On Wed, 2005-03-23 at 14:33 -0700, Shannon Johnston wrote:
> > Once again, I'm stuck with a little problem.
> > I've got a list of 6000 ip addresses in a text file, all of them have a
> > trailing ".". I need to get rid of that before it becomes useful.
> >
> > Does anybody know how to do that? Either in vi or as a sed command?
> 
> In vi or sed it is roughly the same.
> vi:
> :%s/.$//
> 
> or
> sed -e 's/.$//'
> 
> Pretty sure...didn't test either one though.
> In regex, the . means any character and $ means end of line, so both
> expressions mean substitute "any character" just before "end of line"
> with nothing (the nothing in between //)
> --
> Zan Lynx <zlynx at acm.org>
> 
> 
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: lug.boulder.co.us port=6667 channel=#colug
> 
> 
>



More information about the LUG mailing list