bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gawk manual: what if I want the last X chars of a string?


From: Dan Jacobson
Subject: gawk manual: what if I want the last X chars of a string?
Date: 17 Feb 2002 22:09:38 +0800
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1

>>>>> "Dan" == Dan Jacobson <address@hidden> writes:

Dan> The awk manual tells one
Dan>      Thus, the following:

Dan>           printf "%.4s", "foobar"

Dan>      prints `foob'.

Dan> but it should also tell one how to make 'obar'.

>>>>> "A" == Aharon Robbins <address@hidden> writes:

A> I don't see a reason for the documentation on printf to discuss how
A> to use substr().

Well, the user is not going to get an idea of how to print out the
last 4 characters of a string ... a least 100 times harder a task then
printing out the first 4 characters, given he does not know how long
the string is [so forget just a plain substr()], does not want to use
a regexp [as perhaps he wants the last 77 chars and all those "..."
will look confusing] ... anyway, for the user who wants the first X
chars in a string, answers abound in the manual.  For users who want
the last X chars in a string, the manual offers no simple one step
solution.
-- 
http://www.geocities.com/jidanni/ Taiwan(04)25854780



reply via email to

[Prev in Thread] Current Thread [Next in Thread]