Add: awk paragraph search, separated output

pull/181/head
Igor Chubin 2 years ago
parent a26a0ee062
commit adfdf75cb7

@ -47,8 +47,13 @@ awk -v RS='' '
printf '1 2 3' | awk 'BEGIN {OFS=":"}; {print $1,$2,$3}'
# Search paragraph for the given REGEX match.
# Paragraphs will be collapsed together.
awk -v RS='' '/42B/' file
# Search paragraph for the given REGEX match.
# Paragraphs will be separated with a new line.
awk -v RS= ORS='\n\n' '/42B/' file
# Display only first field in text taken from STDIN.
echo 'Field_1 Field_2 Field_3' | awk '{print $1}'
# Note that in this case, you're far better off using cut(1).

Loading…
Cancel
Save