[lug] delete last character of every line

Zan Lynx zlynx at acm.org
Wed Mar 23 15:58:49 MST 2005


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>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20050323/8c663bd9/attachment.pgp>


More information about the LUG mailing list