Understanding awk delimiter - escaping in a regex-based field separator
问题 I have the following shell command: awk -F'\[|\]' '{print $2}' What is this command doing? Split into fields using as delimiter [sometext] ? E.g.: $ echo "this [line] passed to awk" | awk -F'\[|\]' '{print $2}' line Editor's note: Only Mawk, as used on Ubuntu by default, produces the output above. 回答1: The apparent intent is to treat literal [ and ] as field-separator characters, i.e., to split each input record into fields by each occurrence of [ and/or ] , which, with the sample line,