shell script learning (10) extracts data from structured text

A data extraction / post

sed -e 's=/.*==' do.txt

 

2

sed -e 's=/.*=='\ 
-e 's=^\([^:]*\):\(.*\) \([^ ]*\)=\1:\3, \2=' do.txt

 

 

= -E is the first area delimiter, the final sentence data is / are replaced after the empty

 

 

 

The second is the use of e three sub-mode, to complete the ordering

's=^\([^:]*\):\(.*\) \([^ ]*\)=\1:\3, \2='

First subpattern ^ \ ([^:] * \) matches the beginning of a non-: string

The second sub-mode \ (. * \) Matches any character

The third sub-mode \ ([^] * \) matching non-whitespace characters

Together with the string is matched: any text with non-blank character

Sort reorganization \ 1: \ 3 \ 2

 

Guess you like

Origin www.cnblogs.com/mayplestory/p/11997066.html