On 03/28/2019, at 08:25, Rod Buchanan <[email protected] <mailto:[email protected]>>
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 <[email protected]
<mailto:[email protected]>> 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
"[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.