#!/bin/sh ver=1.2 Usage() { prog=`basename $0` cat <0 { begun = 1 } begun==0 && beginafter != "" && match($0, beginafter)>0 { begun = 1 dontfmt[NR] = 1 next } begun==0 { dontfmt[NR] = 1; next } NF < mincol || NF > maxcol { dontfmt[NR] = 1 ; next } ldontaligntag > 0 && substr($0, 1, ldontaligntag) == dontaligntag { $0 = substr($0, ldontaligntag+1, 1000) dontfmt[NR] = 1 next } ldontmatch > 0 && match($0, dontmatchpat)>0 { dontfmt[NR] = 1 next } { for (i=1; i<=nl; i++) { if (lines["l" i] <= NR && NR <= lines["r" i]) { dontfmt[NR] = 1 next } } } { dontfmt[NR] = 0 if (NF > maxnf) maxnf = NF for (i=1; i<=NF; i++) { l = length($i) if (l > len[i]) len[i] = l } } END { for (i=1; i maxnf) firstcol = maxnf+1 if (lastcol > maxnf) lastcol = maxnf # "nleft" is number of spaces required to display columns before firstcol. nleft = 0; for (i=1; i<=maxnf; i++) { if (colwidth[i] > 0 && colwidth[i] < len[i]) { l = colwidth[i] } else { l = len[i] } if (tabright[i]) { fmt[i] = "%" l "s " } else { fmt[i] = "%-" l "s " } if (i < firstcol) { nleft += l + 1 } } ### print "firstcol" firstcol, "lastcol", lastcol, "nleft", nleft # Trim trailing whitespace fmt[maxnf] = substr(fmt[maxnf], 1, length(fmt[maxnf])-1) for (i=1; i<=NR; i++) { if (dontfmt[i] == 1) { printf("%s", Indentation) print text[i] } else { printf("%s", indentation) nf = split(text[i], x) # First print unformatted columns, and keep track of amount # of space used. l = 0; for (j = 1; j < firstcol; j++) { l += length(x[j]) + 1 printf("%s ", x[j]) } # Then skip over remaining part of "nleft" spaces. if (firstcol > 1 && nleft > l) printf("%*.*s", nleft-l, nleft-l, ""); if (nf < lastcol) m = nf else m = lastcol for (j = firstcol; j <= m; j++) printf(fmt[j], x[j]) for (j = m+1; j <= nf; j++) printf("%s ", x[j]) print "" } } }' ${1+"$@"} | case "$title1" in yes ) read line1 LESS=`echo "$line1"|sed -e 's/./\\\\&/g' -e 's/^/-imeP/'` export LESS less ;; * ) cat ;; esac