Reputation: 423
I want to extract all substrings starting with "[A-Z]:" and ending with "[A-Z]:" or the end of the string
so that if my input is
C:\Users\Alex Sim\Libraries\Some Folder D:\Hello world\Something C:\Ran out of names\whatever
my output would be
C:\Users\Alex Sim\Libraries\Some Folder
D:\Hello world\Something
C:\Ran out of names\whatever
Upvotes: 0
Views: 29
Reputation: 92854
Simply with GNU sed:
sed 's/[[:space:]]\([A-Z]:\)/\n\1/g' input.txt
The output:
C:\Users\Alex Sim\Libraries\Some Folder
D:\Hello world\Something
C:\Ran out of names\whatever
Upvotes: 1