[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: awk



Rüdiger Noack wrote:
> Wie kann man awk dazu bringen etwas zu tun, wenn der Eingabestrom "leer"
> ist?

Mit einem END-Block:

awk '$0 != "" {print $1} 
     $0 == "" {print "else"}
     END {if(!NR){print "nix"}}' /dev/null

                                        Danijel Tasov
                                        <dt@vosat.de>
-- 
Randal can write one-liners again.  Everyone is happy, and peace spreads
over the whole Earth.
             -- Larry Wall in <199705101952.MAA00756@wall.org>



Reply to: