[PLUG] sed script help needed

David Fleck dcfleck at protonmail.ch
Fri Mar 19 20:26:10 UTC 2021


Rich-

what's going wrong?  I tried that sed command out on your test lines and got:

'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'



--
- David Fleck

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Friday, March 19, 2021 1:09 PM, Rich Shepard <rshepard at appl-ecosys.com> 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
> PLUG at pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug





More information about the PLUG mailing list