bug-gawk
[Top][All Lists]
Advanced

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

Re: Is it bug ? as it's so confusing


From: Manuel Collado
Subject: Re: Is it bug ? as it's so confusing
Date: Sat, 1 May 2021 15:48:41 +0200
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0

El 01/05/2021 a las 8:08, Budi escribió:
How to have awk to get range or boundary of the beginning to a pattern
tried 1 fails as

$ echo -e 'a\nb\nc\nend\ne\nf\ng\n' |awk '1,/end/ {print $0}'
a
b
c
end
e
f
g

This is expected behavior. Because '1' is an always true condition. Use NR==1 instead.

$ echo -e 'a\nb\nc\nend\ne\nf\ng\n' |awk 'NR==1,/end/ {print $0}'
a
b
c
end

HTH.
--
Manuel Collado - http://mcollado.z15.es



reply via email to

[Prev in Thread] Current Thread [Next in Thread]