Rich...
I don't know SED. You opened the door by mentioning Emacs.... and I know
elisp.
You could
emacs -q --eval (progn (while (not (eobp)) (capitalize-dwim 1))
(save-buffer)) fname
Replacing fname with the name of the file you wanted to modify.



On Fri, Mar 19, 2021 at 11:09 AM Rich Shepard <[email protected]>
wrote:

> I have a sed script (all-caps-to-mixed.sed) that apparently worked some
> years ago but isn't working today. I'd appreciate learning how to fix it.
>
> The script:
> #!/usr/bin/sed
> #
> # usage: sed -rf all-caps-to-mixed.sed < inputfile > outputfile
> # Change from all uppercase words to mixed case.
> #
> s/([A-Z])([A-Z]*)/\1\L\2/g
>
> Here're some test lines; I included different string formats:
>
> '1983-074','AQ Permitting','CR','MID-OREGON CRUSHING CO., INC.','','Notice
> of Civil Penalty Assessment','','8/26/1983','4500'
> '1984-001','WQ Permitting','WR','VANDERVELDE, ROY','','Notice of Civil
> Penalty Assessment',' WQ','5/23/1984','2500'
> '1987-027','WQ Permitting','WQ','MERIT USA, INC. (BRIGGS/INDUSTRIAL
> OIL/FUEL PROCE)','','Notice of Civil Penalty Assessment','
> WQ','5/28/1987','3500'
> '1988-017','Open Burning','SWR','JONES, BILLY AND LADAKE,
> ROBERT','','Notice of Civil Penalty Assessment','','2/18/1988','500'
> '1988-031','Asbestos','NWR','LABENSKE, BILL R. JR.','','Notice of Civil
> Penalty Assessment','','6/12/1988','0'
> '1989-041','','SW','THOMAS, DONN, AKA/DONN BEAM; SCHULTZ,
> RICHARD;,ANN','','Notice of Civil Penalty Assessment','','2/23/1989','0'
>
> While some uppercase strings should be that way, e.g. USA, those are easily
> repaied with emacs search-and-replace. It's the longer strings in
> multi-thousand line files that I want to modify.
>
> TIA,
>
> Rich
>
>
>
>
> _______________________________________________
> PLUG: https://pdxlinux.org
> PLUG mailing list
> [email protected]
> http://lists.pdxlinux.org/mailman/listinfo/plug
>
_______________________________________________
PLUG: https://pdxlinux.org
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug

Reply via email to