A number of my projects standardize on 80 characters per line. I have tried 
to use Process Lines to simplify this process:

1) Text > Process Lines Containing...
2) Check the Grep checkbox
3) Use the following pattern to target all lines with 80 or more characters:

.{{0,79}}

I've done it enough times that it would be useful to have this run as a 
filter so that I don't need to invoke it manually each time. However, a 
(admittedly shitty) first pass with ChatGPT to wrap these steps in a script 
returns a different result.

An example script is shown below.

    #!/bin/bash

    # Read input line by line
    while IFS= read -r line; do
    # Delete characters longer than 80 characters
    modified_line=$(echo "$line" | sed -E 's/.{81,}//g')
      echo "$modified_line"
    done

Is GPT just dumb or am I missing something obvious?

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or believe that the application isn't working correctly, please email 
"[email protected]" rather than posting here. Follow @bbedit on Mastodon: 
<https://mastodon.social/@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 view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/c88577bf-3041-4c98-9819-e0f21823215bn%40googlegroups.com.

Reply via email to