Re: How to put numbers in front of selected lines?

2019-04-11 Thread Christopher Stone
On 04/01/2019, at 09:26, Rod Buchanan mailto:r...@kdsi.com>> 
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
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: How to put numbers in front of selected lines?

2019-04-01 Thread Rod Buchanan

One problem with -w2 is if the file is >= 100 lines it breaks:

$ nl -w2 -s'. ' ...

98. 
99. 
00. 
01. 
02. 

$ nl -nrz -w2 -s'. ' ...

98. 
99. 
00. 
01. 
02. 

> On Mar 30, 2019, at 3:04 AM, Christopher Stone  
> wrote:
> 
> On 03/30/2019, at 02:35, Bill Kochman  > wrote:
>> Chris, you wrote:
>> 
>> #!/usr/bin/env bash
>> nl -nrz -w2 -s'. '
>> 
>> That works on all lines. What about if you have blank lines in the document? 
>> While it works fine on files that have continuous lines of text, the above 
>> indents two spaces and places a period on blank lines.
> 
> 
> Hey Bill,
> 
> The -w2 switch (i.e. -w switch with 2 as its value), designates the width of 
> the padded line number.
> 
> I think the addition of the period in blank lines is a bug in macOS' version 
> of `nl`, because GNU `nl` doesn't have that problem.  (The indention will 
> vary according to -w.)
> 
> 
> #!/usr/bin/env bash
> nl -nrz -ba -w3 -s'. '
> 
> This will number ALL lines including blank ones.
> 
> 
> man nl in the Terminal will get you to the man page for `nl`, so you can see 
> what the various switches do.
> 
> 
> To work around your complaint you can install GNU `nl` with MacPorts or 
> HomeBrew.
> 
> Or you can use a little `sed` to remove the floating period:
> 
> #!/usr/bin/env bash
> nl -nrz -w2 -s'. ' | sed -E 's!^[[:blank:]]+\.!!'
> 
> 
> --
> Take Care,
> Chris
> 
> 
> -- 
> This is the BBEdit Talk public discussion group. If you have a 
> feature request or need technical support, please email
> "supp...@barebones.com" rather than posting to the group.
> Follow @bbedit on Twitter:  >
> --- 
> 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 bbedit+unsubscr...@googlegroups.com 
> .
> To post to this group, send email to bbedit@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/bbedit 
> .

-- 
Rod Buchanan
Kelly Supply Company
1004 W Oklahoma Ave
Grand Island, NE 68802-1328
308 382-5670
308 382-8764 x1120

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: How to put numbers in front of selected lines?

2019-03-30 Thread Christopher Stone
On 03/30/2019, at 06:48, @lbutlr mailto:krem...@kreme.com>> 
wrote:
> osxutils looks interesting.


Hey Lewis,

Thanks for the reminder.  I'd forgotten to install those critters.

In general they're pretty edge-case commands, but they have their uses.

--
Best Regards,
Chris

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: How to put numbers in front of selected lines?

2019-03-30 Thread Bill Kochman
Actually, Homebrew is my default go-to choice for Terminal-based installations. 
However, I figured that MacPorts probably needed an update — which it did — and 
so then I decided to try to find something with it, which I couldn’t find with 
Homebrew.

As it turned out, what I was looking for — nl — is included in the coreutils 
package, which I downloaded with Homebrew.

Yeah, osxutils does look rather interesting. I might give it a go. Maybe not.


Bill Kochman
Bill’s Bible Basics
wordweaver...@gmail.com
https://www.billkochman.com




> On Mar 30, 2019, at 9:48 PM, @lbutlr  wrote:
> 
> On 30 Mar 2019, at 05:37, Bill Kochman  wrote:
>> 
>> Ha! I took it a step further and installed coreutils, moreutils, findutils 
>> and a number of others, via Homebrew and MacPorts.
> 
> Both? I would pick one (Homebrew) and stick with it. I gave up MacPorts 
> because it required a full install of Xcode (8GB) while Homebrew requires 
> only the command line utilities,
> 
>> Do you think I overdid it a bit?
> 
> Perhaps 
> 
> osxutils looks interesting.
> 
> cpathcopy the current working directory to the clipboard
> finfoprint information about a file in a style similar to the Mac OS 
> X Finder
> getfcomment  print a file's Spotlight comment
> geticon  extract a file's icon as an image
> getvolumeshow the global system volume setting
> google   search Google in default browser
> hfsdata  print a file's HFS- or Mac-specific metadata
> lsmaclist directory contents with OS X metadata
> mkalias  create OS X Finder aliases
> rcmacrecursively list files (like lsmac)
> setfcomment  set a file's Spotlight comments
> setfctypes   set heritage OS X File Type or Creator of a file
> setfflagsset a file's Finder flags
> seticon  set a file's OS X Icon
> setlabel set a file's Finder Label
> setsuffixbatch modify file suffices
> setvolumeset the global system volume
> mvtrash  move a file to the Trash
> wikipediasearch Wikipedia in default browser
> wsupdate update the Finder filesystem display
> 
>> The way I figure, they take up so little space, I’d rather have them there 
>> for the rare occasion when someday some app may need one of them.  
> 
> They might conflict with something else, but homebrew is good about keeping 
> things organized.
> 
> 
> -- 
> A sadder and a wiser man he rose the morrow morn.
> 
> 
> -- 
> This is the BBEdit Talk public discussion group. If you have a 
> feature request or need technical support, please email
> "supp...@barebones.com" rather than posting to the group.
> Follow @bbedit on Twitter: 
> --- 
> 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 bbedit+unsubscr...@googlegroups.com.
> To post to this group, send email to bbedit@googlegroups.com.
> Visit this group at https://groups.google.com/group/bbedit.

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: How to put numbers in front of selected lines?

2019-03-30 Thread @lbutlr
On 30 Mar 2019, at 05:37, Bill Kochman  wrote:
> 
> Ha! I took it a step further and installed coreutils, moreutils, findutils 
> and a number of others, via Homebrew and MacPorts.

Both? I would pick one (Homebrew) and stick with it. I gave up MacPorts because 
it required a full install of Xcode (8GB) while Homebrew requires only the 
command line utilities,

> Do you think I overdid it a bit?

Perhaps 

osxutils looks interesting.

cpathcopy the current working directory to the clipboard
finfoprint information about a file in a style similar to the Mac OS X 
Finder
getfcomment  print a file's Spotlight comment
geticon  extract a file's icon as an image
getvolumeshow the global system volume setting
google   search Google in default browser
hfsdata  print a file's HFS- or Mac-specific metadata
lsmaclist directory contents with OS X metadata
mkalias  create OS X Finder aliases
rcmacrecursively list files (like lsmac)
setfcomment  set a file's Spotlight comments
setfctypes   set heritage OS X File Type or Creator of a file
setfflagsset a file's Finder flags
seticon  set a file's OS X Icon
setlabel set a file's Finder Label
setsuffixbatch modify file suffices
setvolumeset the global system volume
mvtrash  move a file to the Trash
wikipediasearch Wikipedia in default browser
wsupdate update the Finder filesystem display

> The way I figure, they take up so little space, I’d rather have them there 
> for the rare occasion when someday some app may need one of them.  

They might conflict with something else, but homebrew is good about keeping 
things organized.


-- 
A sadder and a wiser man he rose the morrow morn.


-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: How to put numbers in front of selected lines?

2019-03-30 Thread Bill Kochman
Ha! I took it a step further and installed coreutils, moreutils, findutils and 
a number of others, via Homebrew and MacPorts.

Do you think I overdid it a bit?

The way I figure, they take up so little space, I’d rather have them there for 
the rare occasion when someday some app may need one of them.  :)


Bill Kochman
Bill’s Bible Basics
wordweaver...@gmail.com
https://www.billkochman.com




> On Mar 30, 2019, at 9:33 PM, @lbutlr  wrote:
> 
> On 30 Mar 2019, at 03:37, Christopher Stone  
> wrote:
>> 
>> `nl` is a part of coreutils.
>> 
>> Here's a list of them: 
>> https://en.wikipedia.org/wiki/List_of_GNU_Core_Utilities_commands
> 
> And, veering ever so slightly off topic, there is also findutils which gives 
> you access to gnu find and locate and xargs as well.
> 
> https://www.gnu.org/software/findutils/
> 
> I always install coreutils and findutils on my Macs.
> 
> 
> -- 
> Advance and attack! Attack and destroy! Destroy and rejoice!
> 
> -- 
> This is the BBEdit Talk public discussion group. If you have a 
> feature request or need technical support, please email
> "supp...@barebones.com" rather than posting to the group.
> Follow @bbedit on Twitter: 
> --- 
> 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 bbedit+unsubscr...@googlegroups.com.
> To post to this group, send email to bbedit@googlegroups.com.
> Visit this group at https://groups.google.com/group/bbedit.

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: How to put numbers in front of selected lines?

2019-03-30 Thread @lbutlr
On 30 Mar 2019, at 03:37, Christopher Stone  wrote:
> 
> `nl` is a part of coreutils.
> 
> Here's a list of them: 
> https://en.wikipedia.org/wiki/List_of_GNU_Core_Utilities_commands

And, veering ever so slightly off topic, there is also findutils which gives 
you access to gnu find and locate and xargs as well.

https://www.gnu.org/software/findutils/

I always install coreutils and findutils on my Macs.


-- 
Advance and attack! Attack and destroy! Destroy and rejoice!

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: How to put numbers in front of selected lines?

2019-03-30 Thread Bill Kochman
Hello Chris,

Ha! Yes, I in fact figured that out and installed coreutils just a bit ago. 
Thanks for your time!  :)


Bill Kochman
Bill’s Bible Basics
wordweaver...@gmail.com
https://www.billkochman.com




> On Mar 30, 2019, at 7:37 PM, Christopher Stone  
> wrote:
> 
> On 03/30/2019, at 03:48, Bill Kochman  > wrote:
>> BTW, I tried to install GNU nl via Homebrew, but I was unable to locate it. 
>> In the Terminal, neither “nl” or “gnunl” worked. Likewise, I visited 
>> Homebrew’s formulae page on the web, and I couldn’t[’t locate it there 
>> either. I suspect that it may be included in some Unix utilities package ...
> 
> 
> Hey Bill,
> 
> `nl` is a part of coreutils.
> 
> Here's a list of them: 
> https://en.wikipedia.org/wiki/List_of_GNU_Core_Utilities_commands 
> 
> 
> --
> Take Care,
> Chris
> 
> 
> -- 
> This is the BBEdit Talk public discussion group. If you have a 
> feature request or need technical support, please email
> "supp...@barebones.com" rather than posting to the group.
> Follow @bbedit on Twitter:  >
> --- 
> 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 bbedit+unsubscr...@googlegroups.com 
> .
> To post to this group, send email to bbedit@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/bbedit 
> .

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: How to put numbers in front of selected lines?

2019-03-30 Thread Christopher Stone
On 03/30/2019, at 03:48, Bill Kochman mailto:wordweaver...@gmail.com>> wrote:
> BTW, I tried to install GNU nl via Homebrew, but I was unable to locate it. 
> In the Terminal, neither “nl” or “gnunl” worked. Likewise, I visited 
> Homebrew’s formulae page on the web, and I couldn’t[’t locate it there 
> either. I suspect that it may be included in some Unix utilities package ...


Hey Bill,

`nl` is a part of coreutils.

Here's a list of them: 
https://en.wikipedia.org/wiki/List_of_GNU_Core_Utilities_commands 


--
Take Care,
Chris

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: How to put numbers in front of selected lines?

2019-03-30 Thread Bill Kochman
Thanks Chris!

The updated script works great!  :)

BTW, I tried to install GNU nl via Homebrew, but I was unable to locate it. In 
the Terminal, neither “nl” or “gnunl” worked. Likewise, I visited Homebrew’s 
formulae page on the web, and I couldn’t[’t locate it there either. I suspect 
that it may be included in some Unix utilities package, but I have no idea what 
its name might be. Any clues? As I said, your script works fine as is, but it 
would be nice to have a version of nl installed, so we don’t have to resort to 
extra steps in your script.


Bill Kochman
Bill’s Bible Basics
wordweaver...@gmail.com
https://www.billkochman.com




> On Mar 30, 2019, at 6:04 PM, Christopher Stone  
> wrote:
> 
> On 03/30/2019, at 02:35, Bill Kochman  > wrote:
>> Chris, you wrote:
>> 
>> #!/usr/bin/env bash
>> nl -nrz -w2 -s'. '
>> 
>> That works on all lines. What about if you have blank lines in the document? 
>> While it works fine on files that have continuous lines of text, the above 
>> indents two spaces and places a period on blank lines.
> 
> 
> Hey Bill,
> 
> The -w2 switch (i.e. -w switch with 2 as its value), designates the width of 
> the padded line number.
> 
> I think the addition of the period in blank lines is a bug in macOS' version 
> of `nl`, because GNU `nl` doesn't have that problem.  (The indention will 
> vary according to -w.)
> 
> 
> #!/usr/bin/env bash
> nl -nrz -ba -w3 -s'. '
> 
> This will number ALL lines including blank ones.
> 
> 
> man nl in the Terminal will get you to the man page for `nl`, so you can see 
> what the various switches do.
> 
> 
> To work around your complaint you can install GNU `nl` with MacPorts or 
> HomeBrew.
> 
> Or you can use a little `sed` to remove the floating period:
> 
> #!/usr/bin/env bash
> nl -nrz -w2 -s'. ' | sed -E 's!^[[:blank:]]+\.!!'
> 
> 
> --
> Take Care,
> Chris
> 
> 
> -- 
> This is the BBEdit Talk public discussion group. If you have a 
> feature request or need technical support, please email
> "supp...@barebones.com" rather than posting to the group.
> Follow @bbedit on Twitter:  >
> --- 
> 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 bbedit+unsubscr...@googlegroups.com 
> .
> To post to this group, send email to bbedit@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/bbedit 
> .

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: How to put numbers in front of selected lines?

2019-03-30 Thread Christopher Stone
On 03/30/2019, at 02:35, Bill Kochman mailto:wordweaver...@gmail.com>> wrote:
> Chris, you wrote:
> 
> #!/usr/bin/env bash
> nl -nrz -w2 -s'. '
> 
> That works on all lines. What about if you have blank lines in the document? 
> While it works fine on files that have continuous lines of text, the above 
> indents two spaces and places a period on blank lines.


Hey Bill,

The -w2 switch (i.e. -w switch with 2 as its value), designates the width of 
the padded line number.

I think the addition of the period in blank lines is a bug in macOS' version of 
`nl`, because GNU `nl` doesn't have that problem.  (The indention will vary 
according to -w.)


#!/usr/bin/env bash
nl -nrz -ba -w3 -s'. '

This will number ALL lines including blank ones.


man nl in the Terminal will get you to the man page for `nl`, so you can see 
what the various switches do.


To work around your complaint you can install GNU `nl` with MacPorts or 
HomeBrew.

Or you can use a little `sed` to remove the floating period:

#!/usr/bin/env bash
nl -nrz -w2 -s'. ' | sed -E 's!^[[:blank:]]+\.!!'


--
Take Care,
Chris

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: How to put numbers in front of selected lines?

2019-03-30 Thread Christopher Stone
On 03/28/2019, at 08:25, Rod Buchanan mailto:r...@kdsi.com>> 
wrote:
> Or create a two-line shell script (name it "NumberLines.sh") and put it in 
> Library/Application Support/BBEdit/Text Filters
> 
>   #!/bin/sh
>   nl -ba -s '. '


Hey Folks,

This method is problematic in that it produces output like this:

 1. All I Want for Christmas Is You 3:46
 2. Astro Zombies 2:13
 3. All The Angels 3:14
 4. AMBULANCE 4:05
 5. Black Dragon Fighting Society 1:37
 6. The Black Parade Is Dead! 1:01
 7. Blood 2:53
 8. Boy Division 2:56
 9. Bulletproof Heart 4:57
10. Burn Bright
11. Bury Me In Black (Demo) 2:38
12. Cancer 2:23
13. Cemetery Drive 3:08
14. Common People 5:35
15. Cubicles 3:54

Although that's easy to work with in BBEdit, because you can select it and use 
Cmd-[ to remove the leading whitespace.

The -ba switch is not necessary if the lines are not broken by vertical 
whitespace.


If you're willing to put up with leading zeros in your number scheme you can do 
this and stick with a `nl` one-liner:

#!/usr/bin/env bash
nl -nrz -w2 -s'. '

01. All I Want for Christmas Is You 3:46
02. Astro Zombies 2:13
03. All The Angels 3:14
04. AMBULANCE 4:05
05. Black Dragon Fighting Society 1:37
06. The Black Parade Is Dead! 1:01
07. Blood 2:53
08. Boy Division 2:56
09. Bulletproof Heart 4:57
10. Burn Bright
11. Bury Me In Black (Demo) 2:38
12. Cancer 2:23
13. Cemetery Drive 3:08
14. Common People 5:35
15. Cubicles 3:54


`nl` with a little `sed` gets back to Vlad's desired output format:

#!/usr/bin/env bash
nl -s '. ' | sed -E 's!^[[:blank:]]+!!'

1. All I Want for Christmas Is You 3:46
2. Astro Zombies 2:13
3. All The Angels 3:14
4. AMBULANCE 4:05
5. Black Dragon Fighting Society 1:37
6. The Black Parade Is Dead! 1:01
7. Blood 2:53
8. Boy Division 2:56
9. Bulletproof Heart 4:57
10. Burn Bright
11. Bury Me In Black (Demo) 2:38
12. Cancer 2:23
13. Cemetery Drive 3:08
14. Common People 5:35
15. Cubicles 3:54


On 03/26/2019, at 23:18, Christopher Stone mailto:listmeis...@suddenlink.net>> wrote:
> ** Unfortunately (and strangely) it does NOT have a built-in number-suffix 
> character-string.

I was mistaken about this in my earlier post.

The -s switch provides that functionality, although it behaves unexpectedly 
under some circumstances.


--
Best Regards,
Chris

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: How to put numbers in front of selected lines?

2019-03-28 Thread Rod Buchanan
Doh!

That should be

chmod 755 NumberLines.sh


> On Mar 28, 2019, at 8:25 AM, Rod Buchanan  wrote:
> 
> 
> Or create a two-line shell script (name it "NumberLines.sh") and put it in 
> Library/Application Support/BBEdit/Text Filters
> 
>   #!/bin/sh
>   nl -ba -s '. ' 
> 
> Make sure it is executable
> 
>   chmod 777 NumberLines.sh
> 
> Then you can run it like so
> 
>   Text->Apply Text Filter->NumberLines
> 
> 
>> On Mar 28, 2019, at 7:34 AM, Greg Raven > > wrote:
>> 
>> Two easy steps to add the line numbers.
>> 
>> 1) Text > Prefix/Suffix Lines … -- prefix each line with ". "
>> 2) Text > Add/Remove Line Numbers …
>> 
>> On Tuesday, March 26, 2019 at 5:50:11 AM UTC-7, Vlad Ghitulescu wrote:
>> Hello!
>> 
>> I have a bunch (64 exactly :-) lines selected (copied from an iTunes 
>> playlist and inserted in BBEdit), like this 5 ones
>> 
>> Another One Bites The Dust 3:37
>> Bicycle Race 3:04
>> Bohemian Rhapsody 5:58
>> Breakthru 4:09
>> Bring Back That Leroy Brown 2:15
>> 
>> and I would like to prepend a number (beginning with 1) in this format
>> 
>> Another One Bites The Dust 3:37
>> Bicycle Race 3:04
>> Bohemian Rhapsody 5:58
>> Breakthru 4:09
>> Bring Back That Leroy Brown 2:15
>> that is
>> 
>> NUMBER. TRACK-TITLE TRACK-LENGTH
>> 
>> How can I do this?
>> 
>> Thanks!
>> 
>> Regards,
>> Vlad
>> 
>> P.S. If I could also replace whatever is before the track length with a 
>> space I would be even happier :-D
>> 
>> 
>> -- 
>> This is the BBEdit Talk public discussion group. If you have a 
>> feature request or need technical support, please email
>> "supp...@barebones.com " rather than posting 
>> to the group.
>> Follow @bbedit on Twitter: > >
>> --- 
>> 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 bbedit+unsubscr...@googlegroups.com 
>> .
>> To post to this group, send email to bbedit@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/bbedit 
>> .
> 
> -- 
> Rod Buchanan
> Kelly Supply Company
> 1004 W Oklahoma Ave
> Grand Island, NE 68802-1328
> 308 382-5670
> 308 382-8764 x1120
> 
> 
> -- 
> This is the BBEdit Talk public discussion group. If you have a 
> feature request or need technical support, please email
> "supp...@barebones.com" rather than posting to the group.
> Follow @bbedit on Twitter:  >
> --- 
> 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 bbedit+unsubscr...@googlegroups.com 
> .
> To post to this group, send email to bbedit@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/bbedit 
> .

-- 
Rod Buchanan
Kelly Supply Company
1004 W Oklahoma Ave
Grand Island, NE 68802-1328
308 382-5670
308 382-8764 x1120

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: How to put numbers in front of selected lines?

2019-03-28 Thread Rod Buchanan

Or create a two-line shell script (name it "NumberLines.sh") and put it in 
Library/Application Support/BBEdit/Text Filters

#!/bin/sh
nl -ba -s '. ' 

Make sure it is executable

chmod 777 NumberLines.sh

Then you can run it like so

Text->Apply Text Filter->NumberLines


> On Mar 28, 2019, at 7:34 AM, Greg Raven  wrote:
> 
> Two easy steps to add the line numbers.
> 
> 1) Text > Prefix/Suffix Lines … -- prefix each line with ". "
> 2) Text > Add/Remove Line Numbers …
> 
> On Tuesday, March 26, 2019 at 5:50:11 AM UTC-7, Vlad Ghitulescu wrote:
> Hello!
> 
> I have a bunch (64 exactly :-) lines selected (copied from an iTunes playlist 
> and inserted in BBEdit), like this 5 ones
> 
> Another One Bites The Dust 3:37
> Bicycle Race 3:04
> Bohemian Rhapsody 5:58
> Breakthru 4:09
> Bring Back That Leroy Brown 2:15
> 
> and I would like to prepend a number (beginning with 1) in this format
> 
> Another One Bites The Dust 3:37
> Bicycle Race 3:04
> Bohemian Rhapsody 5:58
> Breakthru 4:09
> Bring Back That Leroy Brown 2:15
> that is
> 
> NUMBER. TRACK-TITLE TRACK-LENGTH
> 
> How can I do this?
> 
> Thanks!
> 
> Regards,
> Vlad
> 
> P.S. If I could also replace whatever is before the track length with a space 
> I would be even happier :-D
> 
> 
> -- 
> This is the BBEdit Talk public discussion group. If you have a 
> feature request or need technical support, please email
> "supp...@barebones.com" rather than posting to the group.
> Follow @bbedit on Twitter:  >
> --- 
> 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 bbedit+unsubscr...@googlegroups.com 
> .
> To post to this group, send email to bbedit@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/bbedit 
> .

-- 
Rod Buchanan
Kelly Supply Company
1004 W Oklahoma Ave
Grand Island, NE 68802-1328
308 382-5670
308 382-8764 x1120

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: How to put numbers in front of selected lines?

2019-03-28 Thread Greg Raven
Two easy steps to add the line numbers.

1) Text > Prefix/Suffix Lines … -- prefix each line with ". "
2) Text > Add/Remove Line Numbers …

On Tuesday, March 26, 2019 at 5:50:11 AM UTC-7, Vlad Ghitulescu wrote:
>
> Hello!
>
> I have a bunch (64 exactly :-) lines selected (copied from an iTunes 
> playlist and inserted in BBEdit), like this 5 ones
>
> Another One Bites The Dust 3:37
> Bicycle Race 3:04
> Bohemian Rhapsody 5:58
> Breakthru 4:09
> Bring Back That Leroy Brown 2:15
>
> and I would like to prepend a number (beginning with 1) in this format
>
>1. Another One Bites The Dust 3:37 
>2. Bicycle Race 3:04 
>3. Bohemian Rhapsody 5:58 
>4. Breakthru 4:09 
>5. Bring Back That Leroy Brown 2:15 
>
> that is
>
> NUMBER. TRACK-TITLE TRACK-LENGTH
>
> How can I do this?
>
> Thanks!
>
> Regards,
> Vlad
>
> P.S. If I could also replace whatever is before the track length with a 
> space I would be even happier :-D
>

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: How to put numbers in front of selected lines?

2019-03-27 Thread Vlad Ghitulescu



On 26 Mar 2019, at 14:40, Stephane Gauvin wrote:

> whenever I have this kind of (uncommon) task, I copy/paste in a
> spreadsheet, do what I have to do, copy/paste back into BBEdit.

!

It's so obvious I didn't even think about it! Thanks!

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: How to put numbers in front of selected lines?

2019-03-26 Thread Christopher Stone
On 03/26/2019, at 05:36, Vlad Ghitulescu mailto:v...@ghitulescu.de>> wrote:
> I have a bunch (64 exactly :-) lines selected (copied from an iTunes playlist 
> and inserted in BBEdit), like this 5 ones
> 
> Another One Bites The Dust 3:37
> Bicycle Race 3:04
> Bohemian Rhapsody 5:58
> Breakthru 4:09
> Bring Back That Leroy Brown 2:15
> 
> and I would like to prepend a number (beginning with 1) in this format
> 
> 1 Another One Bites The Dust 3:37
> 2 Bicycle Race 3:04
> 3 Bohemian Rhapsody 5:58
> 4 Breakthru 4:09
> 5 Bring Back That Leroy Brown 2:15


Hey Vlad,

BBEdit's Add/Remove Line Numbers tool is easy to use, but is very limited in 
that it can't deal with number termination characters and such.

Personally I think Bare Bones needs to add a suffix character string to the 
tool, so it can more versatilely handle typical line numbering use-cases.


Probably the simplest way to handle this task is with a little awk in a BBEdit 
Text Filter.  Bind it to a keyboard shortcut and go-to-town.


#!/usr/bin/env bash

awk '{print NR ". " $0}'

** The 'NR' token in awk means Number of Records processed – and '$0' is the 
whole record (or line) being processed.


The `nl` command line tool is specifically designed for numbering lines, and 
has a few tricks up it's sleeve:


#!/usr/bin/env bash
nl -n ln -w 2 -s ' ' | sed -E 's!^([0-9]+)!\1.!'

** Unfortunately (and strangely) it does NOT have a built-in number-suffix 
character-string.

In sed I typically replace the canonical '/' command-separator-character with 
an exclamation point, because this reads better for me – and I can avoid the 
leaning-toothpick effect when finding/replacing forward slashes.


On 03/26/2019, at 08:08, ThePorgie mailto:thepo...@gmail.com>> wrote:
> There was a post in this group to do this very thing. I can no longer find it 
> to credit the creator. However what he posted was to put this code into a 
> BBedit file:


That was posted by me back in December of 2018.

For Vlad's job it can be simplified to this:


#!/usr/bin/env perl -sw
use utf8;

my $cntr = 0;

while (<>) {
   print ++$cntr.". $_";
}


--
Take Care,
Chris

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: How to put numbers in front of selected lines?

2019-03-26 Thread Stephane Gauvin
whenever I have this kind of (uncommon) task, I copy/paste in a
spreadsheet, do what I have to do, copy/paste back into BBEdit.

On Tue, Mar 26, 2019 at 9:30 AM Rich Siegel  wrote:

> On 3/26/19 at 9:27 AM, wordweaver...@gmail.com (Bill Kochman) wrote:
>
> >Is there a way to use the "Add/Remove Line Numbers" option to add a
> >period after each number, followed by a space?
>
> There is not. However, one could add a step and use a Grep
> search and replace to change "\d+" into "\0. ".
>
> R.
> --
> Rich Siegel Bare Bones Software, Inc.
>   
>
> Someday I'll look back on all this and laugh... until they
> sedate me.
>
> --
> This is the BBEdit Talk public discussion group. If you have a
> feature request or need technical support, please email
> "supp...@barebones.com" rather than posting to the group.
> Follow @bbedit on Twitter: 
> ---
> 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 bbedit+unsubscr...@googlegroups.com.
> To post to this group, send email to bbedit@googlegroups.com.
> Visit this group at https://groups.google.com/group/bbedit.
>


-- 


Stéphane Gauvin, Ph.D.
Professeur Titulaire
Département de marketing
Université Laval, Québec QC G1V 0A6
+1 (418) 656 2131 x2158
www.gauvin.net

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: How to put numbers in front of selected lines?

2019-03-26 Thread Rich Siegel

On 3/26/19 at 9:27 AM, wordweaver...@gmail.com (Bill Kochman) wrote:


Is there a way to use the "Add/Remove Line Numbers" option to add a
period after each number, followed by a space?


There is not. However, one could add a step and use a Grep 
search and replace to change "\d+" into "\0. ".


R.
--
Rich Siegel Bare Bones Software, Inc.
  

Someday I'll look back on all this and laugh... until they 
sedate me.


--
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email

"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: How to put numbers in front of selected lines?

2019-03-26 Thread Bill Kochman
Rich,

Is there a way to use the "Add/Remove Line Numbers" option to add a period 
after each number, followed by a space? Or would one have to use the 
"Prefix/Suffix Lines" option first to add the period and space, and then use 
the "Add/Remove Line Numbers" option to add the actual numbers, but without 
enabling the “include space after number” option? Or would it just be simpler 
to use a script — perl, AppleScript, shell script -- such as the aforementioned 
one? Thanks!

Kind regards,

Bill Kochman
Bill’s Bible Basics
wordweaver...@gmail.com
https://www.billkochman.com




> On Mar 26, 2019, at 11:15 PM, Rich Siegel  wrote:
> 
> On 3/26/19 at 9:08 AM, v...@ghitulescu.de (Vlad Ghitulescu) wrote:
> 
>>> Use the line number tool in BBEdit
>> 
>> Where is it? Searching for "*line*" or "*number*" doesn't help.
> 
> R.
> -- 
> Rich Siegel Bare Bones Software, Inc.
>   
> 
> Someday I'll look back on all this and laugh... until they sedate me.

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: How to put numbers in front of selected lines?

2019-03-26 Thread Vlad Ghitulescu

Thanks!
I thougth this is the line numbering in a file, in the gutter!
Thanks again!



On 26 Mar 2019, at 14:15, Rich Siegel wrote:


On 3/26/19 at 9:08 AM, v...@ghitulescu.de (Vlad Ghitulescu) wrote:


Use the line number tool in BBEdit


Where is it? Searching for "*line*" or "*number*" doesn't help.


R.
--
Rich Siegel Bare Bones Software, Inc.
  



Someday I'll look back on all this and laugh... until they sedate me.

--
This is the BBEdit Talk public discussion group. If you have a
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
---
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 bbedit+unsubscr...@googlegroups.com.

To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


--
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email

"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: How to put numbers in front of selected lines?

2019-03-26 Thread Vlad Ghitulescu


On 26 Mar 2019, at 14:05, Jan Erik Moström wrote:

> Use the line number tool in BBEdit

Where is it? Searching for "*line*" or "*number*" doesn't help.

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: How to put numbers in front of selected lines?

2019-03-26 Thread ThePorgie
There was a post in this group to do this very thing. I can no longer find 
it to credit the creator. However what he posted was to put this code into 
a BBedit file:


#!/usr/bin/env perl -sw
use utf8;

$/ = "\n";
my $cntr = 0;

while (<>) {
   print ++$cntr.". ";
   chomp;
   print;
   print "\n";
}


Save that as YourFilterName.pl to "~/Library/Application 
Support/BBEdit/Text Filters/YourFilterName.pl

***Not sure if a relaunch is necessary but it couldn't hurt.
Open your list and go the Menu Text->Apply Text Filter and select the 
filter you just created.


Again, I did not write this and deserve no credit and wish I could find the 
thread were I got this from so as to properly credit the person who did 
write it.

-G 



On Tuesday, March 26, 2019 at 8:50:11 AM UTC-4, Vlad Ghitulescu wrote:
>
> Hello!
>
> I have a bunch (64 exactly :-) lines selected (copied from an iTunes 
> playlist and inserted in BBEdit), like this 5 ones
>
> Another One Bites The Dust 3:37
> Bicycle Race 3:04
> Bohemian Rhapsody 5:58
> Breakthru 4:09
> Bring Back That Leroy Brown 2:15
>
> and I would like to prepend a number (beginning with 1) in this format
>
>1. Another One Bites The Dust 3:37 
>2. Bicycle Race 3:04 
>3. Bohemian Rhapsody 5:58 
>4. Breakthru 4:09 
>5. Bring Back That Leroy Brown 2:15 
>
> that is
>
> NUMBER. TRACK-TITLE TRACK-LENGTH
>
> How can I do this?
>
> Thanks!
>
> Regards,
> Vlad
>
> P.S. If I could also replace whatever is before the track length with a 
> space I would be even happier :-D
>

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: How to put numbers in front of selected lines?

2019-03-26 Thread Jan Erik Moström
On 26 Mar 2019, at 11:36, Vlad Ghitulescu wrote:

> How can I do this?

Use the line number tool in BBEdit

= jem

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.