I'm trying to format a text file. Right now it generally looks like this:
s ApartCD Compact DiscCD-ROM Compact Disc-Read-Only MemoryCD-RW Compact Disc-RewritableCDFS Compact Disc File SystemCERT Computer Emergency Response TeamCFS Central File System, Common File System, or Command File SystemACRONYM SPELLED OUTCGA Computer Graphics and ApplicationsCIDR Classless Inter-Domain RoutingCIFS Common Internet File SystemCMOS Complementary Metal-Oxide SemiconductorCNR Communications and Networking RiserCOMx Communication port (x=port number)CPU Central Processing UnitCRT Cathode-Ray TubeDaaS Data as a ServiceDAC Discretionary Access ControlDB-25 Serial Communications D-Shell Connector, 25 pinsDB-9 Serial Communications D-Shell Connector, 9 pinsDBaaS Database as a Service DC Direct CurrentDDoS Distributed Denial of ServiceDDR Double Data RateDDR RAM Double Data Rate Random Access MemoryDFS Distributed File SystemDHCP Dynamic Host Configuration ProtocolDIMM Dual Inline Memory ModuleDIN Deutsche Industrie NormDLT Digital Linear TapeDLP Digital Light P
This is just a sample I copied. To start with, I'd like to insert a newline between every instance of a lowercase letter immediately followed by an uppercase letter. I've figured out from reading the GNU sed manual that I can use the bracket ranges [:lower:]
and [:upper:]
for this, (I think [[:lower:]]+[[:upper:]]
is the right pattern) but I have yet to nail down the right command or general syntax to make this work. I've found several commands for appending newlines, but none for inserting them into a regex.
This is my first time using sed. I have no idea if this is the best tool for the job or not. Any help is greatly appreciated, and if it's not too much trouble, please explain your command so I can perhaps learn something and not have to bother anybody in the future. Thank you.