On Mon, Sep 17, 2012 at 7:57 AM, Cam Hutchison 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 anything to
Morning Star 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 first run
of awk
On Sun, Sep 16, 2012 at 4:28 PM, Christofer C. Bell
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 looking for.
> The bash po
On Sun, Sep 16, 2012 at 3:44 AM, Morning Star
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
> line_6
> line_7
>
inputfile
>
thanks, Teemu. i already know that, but right now i need to understand
how passing for loop bash variables to awk works.
--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.or
On Sun, Sep 16, 2012 at 4:14 PM, emmanuel segura 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:59 PM, Alex Hutton 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 debian-user-requ...@lists.debian.org
with
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:
>
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
line_6
line_7
line_8
line_9
line_10
here is the desired output:
line_1
line_2
line_3
here i
On Sun, Feb 27, 2011 at 10:53:44PM -0600, Boyd Stephen Smith Jr. wrote:
>
> Bash is not adding quotes.[1] It is failing to remove them. If you really
> want to understand what is happening, install the susv2 or susv3 packages
> from contrib and read the section "Shell Command Language". Parti
In <20110228004108.GA3922@playground>, Mike McClain wrote:
>On Sun, Feb 27, 2011 at 12:45:27PM -0600, Boyd Stephen Smith Jr. wrote:
>> In <20110225222127.GA1996@playground>, Mike McClain wrote:
>> >This only bites me once in a while but when it does it can be very
>> >frustrating so any hints / tip
On Sun, Feb 27, 2011 at 12:45:27PM -0600, Boyd Stephen Smith Jr. wrote:
> In <20110225222127.GA1996@playground>, Mike McClain wrote:
> >This only bites me once in a while but when it does it can be very
> >frustrating so any hints / tips are welcome.
>
> FOO="stuff 'with' qu\"otes"
> echo $FOO
> e
In <20110225222127.GA1996@playground>, Mike McClain wrote:
>This only bites me once in a while but when it does it can be very
>frustrating so any hints / tips are welcome.
FOO="stuff 'with' qu\"otes"
echo $FOO
echo stuff 'with' qu\"otes
Yes, quote removal happens after parameter expansion, but i
On 25.02.2011 23:21, Mike McClain wrote:
I occasionally have problems with bash variables, for instance
the following command lists (along with everything else)
2 *.deb files in /home/mike/
root@/deb40a:~> FIND1="-maxdepth 1 -type f -print -name '*'"; \
GREP=&qu
* 2011-02-27 09:12 (+0200), Teemu Likonen wrote:
> * 2011-02-25 14:21 (-0800), Mike McClain wrote:
>> root@/deb40a:~> FIND1="-maxdepth 1 -type f -print -name '*'"; \
>> GREP="-v '\.\(deb\|gz\|tgz\|bz2\|tbz\|zip\)$'"; \
>> find /home/mike/ $FIND1 | grep $GREP ;
> Try removing the single q
* 2011-02-25 14:21 (-0800), Mike McClain wrote:
> I occasionally have problems with bash variables, for instance the
> following command lists (along with everything else) 2 *.deb files in
> /home/mike/
>
> root@/deb40a:~> FIND1="-maxdepth 1 -type f -print -name '*&
On Sat, Feb 26, 2011 at 03:18:43PM +, T o n g wrote:
> On Fri, 25 Feb 2011 14:21:27 -0800, Mike McClain wrote:
>
> > the following command lists (along with everything else)
> > 2 *.deb files in /home/mike/
> >
> > root@/deb40a:~> FIND1="-maxdepth 1 -type f -print -name '*'"; \
> > GREP=
On Fri, 25 Feb 2011 14:21:27 -0800, Mike McClain wrote:
> the following command lists (along with everything else)
> 2 *.deb files in /home/mike/
>
> root@/deb40a:~> FIND1="-maxdepth 1 -type f -print -name '*'"; \
> GREP="-v '\.\(deb\|gz\|tgz\|bz2\|tbz\|zip\)$'"; \ find /home/mike/
> $FI
Hi Mike,
Please add OT to subject ;-)
On Fri, Feb 25, 2011 at 11:21 PM, Mike McClain wrote:
> I occasionally have problems with bash variables, for instance
> the following command lists (along with everything else)
> 2 *.deb files in /home/mike/
>
> root@/deb40a:~> FIND1=&q
I occasionally have problems with bash variables, for instance
the following command lists (along with everything else)
2 *.deb files in /home/mike/
root@/deb40a:~> FIND1="-maxdepth 1 -type f -print -name '*'"; \
GREP="-v '\.\(deb\|gz\|tgz\|bz2\|tbz\|zip\)$
On Mon, Jan 26, 2004 at 03:54:52PM -0500, David Z Maze wrote:
> Matt Price <[EMAIL PROTECTED]> writes:
>
> > Now, if this information were stored in a file, it would be simple to
> > manipulate with regex's:
> >
> > sed 's/@/ -at- /' addressfile
> >
> > But I don't see an obvious way to get sed or
Matt Price <[EMAIL PROTECTED]> writes:
> Now, if this information were stored in a file, it would be simple to
> manipulate with regex's:
>
> sed 's/@/ -at- /' addressfile
>
> But I don't see an obvious way to get sed or awwk to take variable values
> as input. I can do the following:
>
> FROM=`f
On Mon, Jan 26, 2004 at 01:05:08PM +0100, Philipp Weis wrote:
> On 26 Jan 2004, Matt Price <[EMAIL PROTECTED]> wrote:
> > So I asusme the script is running, but it's not receiving the data it
> > needs, or at least not understanding it.
> >
>
> Procmail sends the message via STDIN, so you would
* Raffaele Sandrini ([EMAIL PROTECTED]) spake thusly:
...
> BTW: what is the difference between $KDEDIR and ${KDEDIR}? When is wich used?
RTFM.
Ok, ${FOO}bar means variable $FOO followed by "bar",
$FOObar means variable $FOObar. Capisce?
Dima
--
I'm going to exit now since you don't want me to
On Tuesday, September 25, 2001 1:17 PM, [EMAIL PROTECTED] wrote
> BTW: what is the difference between $KDEDIR and
> ${KDEDIR}? When is wich used?
They refer to the same data. The braces form is to
seprate the variable from the context. For example:
rename $fname $fnamebackup # is ambiguous,
On Tue, Sep 25, 2001 at 08:24:12PM +0200, Raffaele Sandrini wrote:
| Hi,
|
| I have a problem with bash vars. For my KDE copileing stuff i have made some
| files wich contain the "configure" command so that i can easily alter it and
| that i can remember wich options i used. E.g. there is a file
> it
>
> > takes the string "$KDEDIR". How can i bring BASH to take KDEDIR as a
>
> variable?
>
> I think what you are saying is you want to put
> a line: ./configure --prefix=${KDEDIR} --enable-final ...
> in your conf_kdelibs file and then have the main script
> execute that (and other ) lines i
On Tuesday, September 25, 2001 11:24 AM, [EMAIL PROTECTED]
>[...] there is a file "conf_kdelibs"
> the file contais that line:
> ./confugure --prefix=/opt/kde --enable-final ...
> Now i want to set for the prefix /opt/kde the $KDEDIR variable.
> This "conf_kdelibs" file is called by my compile
Hi,
I have a problem with bash vars. For my KDE copileing stuff i have made some
files wich contain the "configure" command so that i can easily alter it and
that i can remember wich options i used. E.g. there is a file "conf_kdelibs"
the file contais that line:
./confugure --prefix=/opt/kde --
29 matches
Mail list logo