On Mon, Sep 17, 2012 at 7:57 AM, Cam Hutchison c...@xdna.net wrote:
When awk runs, it reads its input until EOF. In your loop, the first run
of awk is consuming all the input from stdin (cat input) and printing
the first line. For the subsequent iterations through the loop, awk no
longer has
Morning Star [2012-09-16 15:44:05 +0700] wrote:
I get a difficulty to produce the desired output using awk. i want to
use for loop bash variable as the input to the awk variable here is
the illustrated input:
here is the desired output:
line_1
line_2
line_3
here is what i do:
cat input
On Sun, Sep 16, 2012 at 3:59 PM, Alex Hutton highspeed...@gmail.com wrote:
I would do :
cat input | head -n3
thanks, alex. i already know that, but right now i need to understand
how passing for loop bash variables to awk works.
--
To UNSUBSCRIBE, email to
On Sun, Sep 16, 2012 at 4:14 PM, emmanuel segura emi2f...@gmail.com wrote:
awk '/line/ {print; if(FNR % 3 == 0){exit}}' var
thanks, emmanuel. i already know that, but right now i need to understand
how passing for loop bash variables to awk works.
--
To UNSUBSCRIBE, email to
On Sun, Sep 16, 2012 at 3:53 PM, Teemu Likonen tliko...@iki.fi wrote:
Maybe not what you are asking for but one can get the desired output
with these:
$ awk 'NR = 1 NR = 3 { print }' inputfile
$ head -n3 inputfile
$ sed -n 1,3p inputfile
thanks, Teemu. i already know that,
On Sun, Sep 16, 2012 at 3:44 AM, Morning Star
morning.star.c...@gmail.com wrote:
Hi guys,
I get a difficulty to produce the desired output using awk. i want to
use for loop bash variable as the input to the awk variable
here is the illustrated input:
line_1
line_2
line_3
line_4
line_5
On Sun, Sep 16, 2012 at 4:28 PM, Christofer C. Bell
christofer.c.b...@gmail.com wrote:
$ for (( i=1;i=3;i++ )); do gawk -v var=$i 'NR == var { print}' input ; done
You're asking awk to read lines from a file, so you need to give the
file over to awk. The above gives you the output you're
Morning Star morning.star.c...@gmail.com writes:
here is the desired output:
line_1
line_2
line_3
here is what i do:
cat input | for (( i=1;i=3;i++ )); do gawk -v var=$i 'NR == var { print}';
done
but, the result is always:
line_1
When awk runs, it reads its input until EOF. In your loop, the
8 matches
Mail list logo