On 04/01/2019, at 09:26, Rod Buchanan <[email protected] <mailto:[email protected]>> 
wrote:
> One problem with -w2 is if the file is >= 100 lines it breaks:


Hey Rod,

If I remember correctly Bill's original question specified fewer than 100 
lines, so that's what I was working with at the time.

Mark is on the money about using `wc` to calculate the pad.

Here's one example:


#!/usr/bin/env bash

stdIN=$(cat);
numPad=$(echo "$stdIN" | wc -l | sed -E 's![[:blank:]]!!g' | wc -m)
echo "$stdIN" | nl -nrz -w $(($numPad - 1)) -s'. '


For some inexplicable reason `wc` on Sierra prepends spaces to its output – 
hence the `sed` command in the numPad code.

The current GNU `wc` doesn't have this problem.

--
Best Regards,
Chris

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <https://www.twitter.com/bbedit>
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/bbedit.

Reply via email to