David, 

I suspect Chris S. is correct and we’re using different OS versions and so 
different versions of awk. 

Looks like I sent you down a rabbit hole. 

Definitely try his Perl script and let us know if it worked. 

--Chris(topher)?

> On Jan 6, 2022, at 6:07 AM, David G Wagner <[email protected]> wrote:
> 
> 
> Well, not sure what is going on. Here is the three chapters of data after I 
> run the corrected Text Filter. Before I executed your script, I executed 
> Mormdliz line endings to just make sure though I am only working on an Mac or 
> related Apple items.
> 
> I was going to send you the actual three chapters, but it will go to the 
> whole group which I think is too much data.
> 
> If you want to send email to [email protected] and I will send you two 
> txt files with input and the output I get from executing the script.  If not, 
> that is done and will it work it out differently.
> 
> Again thanks for your time and effort to help. It is much appreciated...
> 
> Wags ;)
> WagsWorld
> Hebrews 4:15
> Ph(primary) : 408-914-1341
> Ph(secondary): 408-761-7391
>> On Jan 5, 2022, 19:52 -0800, Christopher Waterman <[email protected]>, 
>> wrote:
>> Sorry David,
>> 
>> I did make a mistake but the output you're getting still confuses me.
>> All my chapter numbers were off by one, but that was it. 
>> 
>> Anyway here is the fixed script. ( I think 🤞)
>> 
>> I provided an example of my input and output, also a screenshot.
>> Be sure to copy the script exactly.
>> 
>> #!/usr/bin/env awk -f
>> 
>> BEGIN {
>>      RS = "#Start#"
>>      ORS = ""
>>      FS = "\n"
>>      OFS = "\n"
>> }
>> 
>> { 
>>      sub( /[0-9]+/, NR-1 , $2 )
>> }
>> 
>> NR != 1 {
>>      print "#Start#" $0
>> }
>> 
>> Input:
>> #Start#
>> 1 In the beginning, God created the heavens and
>> Xxxxxxccx
>> #EndOfGen#
>> #Start#
>> 1 Thus the heavens and the earth were finished,
>> Xxxxxxxx
>> #EndOfGen#
>> #Start#
>> 1 Now the serpent was more crafty than any other beast of the field that the 
>> LORD God had made.
>> Xxxxxxx
>> #EndOfGen#
>> 
>> Output:
>> #Start#
>> 1 In the beginning, God created the heavens and
>> Xxxxxxccx
>> #EndOfGen#
>> #Start#
>> 2 Thus the heavens and the earth were finished,
>> Xxxxxxxx
>> #EndOfGen#
>> #Start#
>> 3 Now the serpent was more crafty than any other beast of the field that the 
>> LORD God had made.
>> Xxxxxxx
>> #EndOfGen#
>> 
>> Here is a screenshot of the results.
>> <script.jpg>
>> 
>> 
>> — Chris(topher)?
>> 
>> 
>> 
>>> On Jan 5, 2022, at 6:34 PM, David G Wagner <[email protected]> wrote:
>>> 
>>> Thank, Chris but did not do as desired.
>>> 
>>> Here is the output received(cutdown from my extended data test):
>>> 
>>> #Start##Start#start#Start#
>>> 3 In the beginning, God created the heavens and the 
>>> #Start#EndOfGen#Start#
>>> #Start#Start#Start#
>>> 7 Thus the heavens and the earth were finished, and #Start#EndOfGen#Start#
>>> #Start#Start#Start#
>>> 11 Now the serpent was more crafty than any other #Start#EndOfGen#Start#
>>> 
>>> Desired out:
>>> 
>>> #Start#
>>> 1 In the beginning, God created the heavens and the 
>>> #EndOfGen#
>>> #Start#
>>> 2 Thus the heavens and the earth were finished, and #EndOfGen#
>>> #Start#
>>> 3 Now the serpent was more crafty than any other
>>> #EndOfGen#
>>> 
>>> What each start and end is a chapter. In the data. You Have the start and 
>>> then 1. What I want to do is replace the 1 with the current chapter number. 
>>> First hit is Chapter 1. The fifth would be Chapter 5, etc.
>>> 
>>> Thoughts??? 
>>> 
>>> Wags ;)
>>> WagsWorld
>>> Hebrews 4:15
>>> Ph(primary) : 408-914-1341
>>> Ph(secondary): 408-761-7391
>>>> On Jan 5, 2022, 18:01 -0800, [email protected], wrote:
>>>> 
>>>> #!/usr/bin/env awk -f
>>>> 
>>>> BEGIN {
>>>> RS = "#Start#"
>>>> ORS = ""
>>>> FS = "\n"
>>>> OFS = "\n"
>>>> }
>>>> 
>>>> {
>>>> sub( /[0-9]+/, NR , $2 )
>>>> print "#Start#" $0
>>>> }
>>> 
>>> 
>>> --
>>> 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 here. Follow @bbedit on Twitter: 
>>> <https://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 view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/bbedit/9934c9ba-53d0-4701-8e4f-c29fb2d94941%40Spark.
>> 
>> --
>> 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 here. Follow @bbedit on Twitter: 
>> <https://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 view this discussion on the web visit 
>> https://groups.google.com/d/msgid/bbedit/4EEA7827-5D01-4FFB-BA29-32B0F15DD589%40rustydogink.com.
> 
> -- 
> 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 here. Follow @bbedit on Twitter: 
> <https://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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/bbedit/9dd2086b-06db-4088-ae95-9752812bc759%40Spark.

-- 
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 here. Follow @bbedit on Twitter: <https://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 view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/52740E0B-B79E-4D8B-AA10-6EC8A5BFC401%40rustydogink.com.

Reply via email to