Quote:
sed -n '/^Disk/ {s! /.*:!!; s!,.*$!!;p }' sourcefile
|
Code:
-n turn off any output unless specified
/^Disk/ for all lines beginning with "Disk", do the following statments (grouped using {})
s! /.*:!! delete one instance of: space, followed by / then any number of characters and then a :
s!,.*$!! at the end of the line, delete: comma, followed by any numuber of characters
p after all the above, print what's left
Note the use of "!" as the delimiter---this allows the literal "/" to be used inside. In the sed "s" command, the first character after the s is the delimiter.