#!/usr/bin/awk -f # Extracts the first sentence in a text. # The first sentence ends when we encounter a period # followed by a space, tab, or end of line. { all = all $0; } /\.( |\t|$)/ { exit; } END { sub( /\.( |\t|$).*/, ".", all ); print all; }