#! /bin/sh # grep a value of a CIF-like tag; take into account values that are on # the next line an that may span several lines PATTERN="$1" shift awk "/${PATTERN}/ { if( NF == 1 ) { getline } if( match( \$0, \"^;\" )) { getline while( !match( \$0, \"^;\" )) { getline } } next } !/${PATTERN}/ { print } " ${1+"$@"}