From aeb74290389cee356e958f94e14d429777e274ac Mon Sep 17 00:00:00 2001 From: Andy Spencer Date: Wed, 9 May 2012 05:02:22 +0000 Subject: [PATCH] fix awk for head command --- index.cgi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.cgi b/index.cgi index f3a4a7e..e311a94 100755 --- a/index.cgi +++ b/index.cgi @@ -71,14 +71,14 @@ function do_cmd { header text/plain case "$1" in head) - awk ' - BEGIN { rows=4; cols=60; } + awk -v 'rows=4' -v 'cols=60' ' FNR==1 { gsub(/.*\//, "", FILENAME); print FILENAME print "-----" } FNR==1,/^$/ { next } /\S/ { i++; printf "%."cols"s\n", $0 } - i>=rows { i=0; print ""; nextfile } + i>=rows { nextfile } + ENDFILE { i=0; print "" } ' $(ls -t db/*) ;; ls) -- 2.43.2