Search the web
Sign In
New User? Sign Up
geeksthatgawk · for GNU Awk questions & discussions
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Messages 158 - 191 of 221   Newest  |  < Newer  |  Older >  |  Oldest
Messages: Show Message Summaries   (Group by Topic) Sort by Date v  
#191 From: "Adam" <onzanews@...>
Date: Tue Dec 27, 2005 1:09 am
Subject: Re: Help On awk
adam_onza
Offline Offline
Send Email Send Email
 
I'm not sure, but
it looks like the apostrophies get in the way.
try:
awk -f":" '/'$username'/ { print $6 }' passwd.bak >output

I hope that works.

--- In geeksthatgawk@yahoogroups.com, renuka prasad
<renukaprasadtg@y...> wrote:
>
> Hi All,
>
>    I need a help from u.I'm getting the home directory
> from  passwd.bak file.I need to find the disk usage of
> that particular user.I'm getting output if i directly
> substitue variable $username with exact username.But
> i'm not getting output when i use in shell script.The
> contents is as follows:
>
> ---------------------------------------------------------------------
> # Script for displaying diskusage based on user name
> # Only username to be supplied by user
> echo "\n Please enter the username:\c"
> read username
> awk -F":" '/$username/ { print $6 }' passwd.bak >
> output
> echo " Home Directory Of $username "
> cat output
> echo " Disk Usage in KB:"
> sudo du -sk < output
> ----------------------------------------------------------------------
>  I really appreciate  any kind of help on this.Thanks
> in advance.
>
> Regards,
> Prasad
>
>
>
>
> __________________________________
> Yahoo! for Good - Make a difference this year.
> http://brand.yahoo.com/cybergivingweek2005/
>

#190 From: renuka prasad <renukaprasadtg@...>
Date: Mon Dec 26, 2005 10:07 am
Subject: Help On awk
renukaprasadtg
Offline Offline
Send Email Send Email
 
Hi All,

    I need a help from u.I'm getting the home directory
from  passwd.bak file.I need to find the disk usage of
that particular user.I'm getting output if i directly
substitue variable $username with exact username.But
i'm not getting output when i use in shell script.The
contents is as follows:

---------------------------------------------------------------------
# Script for displaying diskusage based on user name
# Only username to be supplied by user
echo "\n Please enter the username:\c"
read username
awk -F":" '/$username/ { print $6 }' passwd.bak >
output
echo " Home Directory Of $username "
cat output
echo " Disk Usage in KB:"
sudo du -sk < output
----------------------------------------------------------------------
  I really appreciate  any kind of help on this.Thanks
in advance.

Regards,
Prasad




__________________________________
Yahoo! for Good - Make a difference this year.
http://brand.yahoo.com/cybergivingweek2005/

#189 From: jbutler1532
Date: Thu Dec 8, 2005 5:20 pm
Subject: awk NR
jbutler1532
Offline Offline
 
Can someone kindly show how to print each line of a file to bash
variable from a awk command?

Super Thanks!,
JB

#188 From: "Djamianto, Yonas Yudistira" <yonas.yudistira.djamianto@...>
Date: Thu Nov 10, 2005 1:16 am
Subject: Subject: Hi new and old users of gawk ...
moleklima
Offline Offline
Send Email Send Email
 
Me, use it almost everyday though only simple ones...
Still trying to absorb all the use of it.

YOnas

-----Original Message-----
From: geeksthatgawk@yahoogroups.com
[mailto:geeksthatgawk@yahoogroups.com]
Sent: Thursday, November 10, 2005 1:10 AM
To: geeksthatgawk@yahoogroups.com
Subject: [Geeks that Gawk] Digest Number 91


There are 2 messages in this issue.

Topics in this digest:

       1. Hi new and old users of gawk ...
            From: "sabre 2/3 tiger" <s-ml3@...>
       2. RE: Hi new and old users of gawk ...
            From: "Stout, Danny" <danny.stout@...>


________________________________________________________________________
________________________________________________________________________

Message: 1
    Date: Wed, 09 Nov 2005 09:09:34 -0000
    From: "sabre 2/3 tiger" <s-ml3@...>
Subject: Hi new and old users of gawk ...

After some ages, well almost 10 years, I've just spent an hour writing
another short gawk script to convert a waypoints GPX file to a track
GPX file. It was fun programming in awk again. An additional hour was
spent earlier looking/installing/reading newer gawk 3.1.3 replacing my
old gawk 2.15. ;-)

Then I wondered whether there are many users of gawk around still. So
here I am.

BTW, I do much less scripting now, as usually happens when you climb
up the management chain. :-(

regards, sabre23t =^.^=







________________________________________________________________________
________________________________________________________________________

Message: 2
    Date: Wed, 9 Nov 2005 09:37:52 -0600
    From: "Stout, Danny" <danny.stout@...>
Subject: RE: Hi new and old users of gawk ...

Use AWK (gawk) all the time... is a mainstay in my utilities spread
across Windows, Linux, UNIX, OpenVMS platforms.

Best to you,
dan

-----Original Message-----
From: geeksthatgawk@yahoogroups.com
[mailto:geeksthatgawk@yahoogroups.com]On Behalf Of sabre 2/3 tiger
Sent: Wednesday, November 09, 2005 3:10 AM
To: geeksthatgawk@yahoogroups.com
Subject: [Geeks that Gawk] Hi new and old users of gawk ...


After some ages, well almost 10 years, I've just spent an hour writing
another short gawk script to convert a waypoints GPX file to a track
GPX file. It was fun programming in awk again. An additional hour was
spent earlier looking/installing/reading newer gawk 3.1.3 replacing my
old gawk 2.15. ;-)

Then I wondered whether there are many users of gawk around still. So
here I am.

BTW, I do much less scripting now, as usually happens when you climb
up the management chain. :-(

regards, sabre23t =^.^=








SPONSORED LINKS
Basic
<http://groups.yahoo.com/gads?t=ms&k=Basic+programming+language&w1=Basic
+programming+language&w2=Computer+programming+languages&w3=Programming+l
anguages&w4=Java+programming+language&c=4&s=126&.sig=bnac3LCZpttb3c9FvbV
U-A> programming language  Computer
<http://groups.yahoo.com/gads?t=ms&k=Computer+programming+languages&w1=B
asic+programming+language&w2=Computer+programming+languages&w3=Programmi
ng+languages&w4=Java+programming+language&c=4&s=126&.sig=1Czd2hKCO9_u4KV
ZQperFQ> programming languages  Programming
<http://groups.yahoo.com/gads?t=ms&k=Programming+languages&w1=Basic+prog
ramming+language&w2=Computer+programming+languages&w3=Programming+langua
ges&w4=Java+programming+language&c=4&s=126&.sig=TyHGCjod4YOKITrSq1xccQ>
languages
Java
<http://groups.yahoo.com/gads?t=ms&k=Java+programming+language&w1=Basic+
programming+language&w2=Computer+programming+languages&w3=Programming+la
nguages&w4=Java+programming+language&c=4&s=126&.sig=PZAexF9LyXpKb3HDJSlB
1g> programming language

   _____

YAHOO! GROUPS LINKS



*  Visit your group " geeksthatgawk
<http://groups.yahoo.com/group/geeksthatgawk> " on the web.


*  To unsubscribe from this group, send an email to:
   geeksthatgawk-unsubscribe@yahoogroups.com
<mailto:geeksthatgawk-unsubscribe@yahoogroups.com?subject=Unsubscribe>


*  Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service <http://docs.yahoo.com/info/terms/> .


   _____




[Non-text portions of this message have been removed]





________________________________________________________________________
________________________________________________________________________



------------------------------------------------------------------------
Yahoo! Groups Links




------------------------------------------------------------------------





This e-mail and any attachment is for authorised use by the intended
recipient(s) only. It may contain proprietary material, confidential information
and/or be subject to legal privilege. It should not be copied, disclosed to,
retained or used by, any other party. If you are not an intended recipient then
please promptly delete this e-mail and any attachment and all copies and inform
the sender. Thank you.

#187 From: "Stout, Danny" <danny.stout@...>
Date: Wed Nov 9, 2005 3:37 pm
Subject: RE: [Geeks that Gawk] Hi new and old users of gawk ...
dasthcc
Offline Offline
Send Email Send Email
 
Use AWK (gawk) all the time... is a mainstay in my utilities spread across
Windows, Linux, UNIX, OpenVMS platforms.

Best to you,
dan

-----Original Message-----
From: geeksthatgawk@yahoogroups.com [mailto:geeksthatgawk@yahoogroups.com]On
Behalf Of sabre 2/3 tiger
Sent: Wednesday, November 09, 2005 3:10 AM
To: geeksthatgawk@yahoogroups.com
Subject: [Geeks that Gawk] Hi new and old users of gawk ...


After some ages, well almost 10 years, I've just spent an hour writing
another short gawk script to convert a waypoints GPX file to a track
GPX file. It was fun programming in awk again. An additional hour was
spent earlier looking/installing/reading newer gawk 3.1.3 replacing my
old gawk 2.15. ;-)

Then I wondered whether there are many users of gawk around still. So
here I am.

BTW, I do much less scripting now, as usually happens when you climb
up the management chain. :-(

regards, sabre23t =^.^=








SPONSORED LINKS
Basic 
<http://groups.yahoo.com/gads?t=ms&k=Basic+programming+language&w1=Basic+program\
ming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java\
+programming+language&c=4&s=126&.sig=bnac3LCZpttb3c9FvbVU-A> programming
language  Computer 
<http://groups.yahoo.com/gads?t=ms&k=Computer+programming+languages&w1=Basic+pro\
gramming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=\
Java+programming+language&c=4&s=126&.sig=1Czd2hKCO9_u4KVZQperFQ> programming
languages  Programming 
<http://groups.yahoo.com/gads?t=ms&k=Programming+languages&w1=Basic+programming+\
language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+prog\
ramming+language&c=4&s=126&.sig=TyHGCjod4YOKITrSq1xccQ> languages
Java 
<http://groups.yahoo.com/gads?t=ms&k=Java+programming+language&w1=Basic+programm\
ing+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+\
programming+language&c=4&s=126&.sig=PZAexF9LyXpKb3HDJSlB1g> programming language

   _____

YAHOO! GROUPS LINKS



*  Visit your group " geeksthatgawk
<http://groups.yahoo.com/group/geeksthatgawk> " on the web.


*  To unsubscribe from this group, send an email to:
   geeksthatgawk-unsubscribe@yahoogroups.com
<mailto:geeksthatgawk-unsubscribe@yahoogroups.com?subject=Unsubscribe>


*  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
<http://docs.yahoo.com/info/terms/> .


   _____




[Non-text portions of this message have been removed]

#186 From: "sabre 2/3 tiger" <s-ml3@...>
Date: Wed Nov 9, 2005 9:09 am
Subject: Hi new and old users of gawk ...
sabre23t
Offline Offline
Send Email Send Email
 
After some ages, well almost 10 years, I've just spent an hour writing
another short gawk script to convert a waypoints GPX file to a track
GPX file. It was fun programming in awk again. An additional hour was
spent earlier looking/installing/reading newer gawk 3.1.3 replacing my
old gawk 2.15. ;-)

Then I wondered whether there are many users of gawk around still. So
here I am.

BTW, I do much less scripting now, as usually happens when you climb
up the management chain. :-(

regards, sabre23t =^.^=

#185 From: "Rodrigo Hjort" <rodrigo_hjort@...>
Date: Mon Aug 29, 2005 12:52 pm
Subject: Re: Formatting Problem with sprintf()
rodrigo_hjort
Offline Offline
Send Email Send Email
 
Thanks, Adam!

It solved my problem!

Regards,

Rodrigo


--- In geeksthatgawk@yahoogroups.com, "Adam" <onzanews@e...> wrote:
> hello Rodrigo,
> try
> $ awk 'BEGIN{ print sprintf("%05d, %06.2f", 23, 4.5) }'
> 00023, 004.50
>
> the '6' in "%06.2f" is the minimum width of the outputed float.
> (including the decimal point and the fraction part.)
> EG:
> $ awk 'BEGIN{ print length(sprintf("%06.2f", 4.5)) }'
> 6
>
> the 2 in "%06.2f" is the minimum width of the fraction part.
> EGs:
> pattern  output
> "%06.2f" 004.50
> "%06.3f" 04.500
> "%06.4f" 4.5000
> "%06.5f" 4.50000
> "%06.6f" 4.500000
>
> hope this helps
> +m
> za (Adam Onza)
>
> --- In geeksthatgawk@yahoogroups.com, "Rodrigo Hjort"
> <rodrigo_hjort@y...> wrote:
> > Hi, AWK users!
> >
> > When using sprintf() to format float numbers with left padding zeroes,
> > it doesn't work. For example, the output desired below should be
> > "00023, 004.50".
> >
> > $ awk 'BEGIN{ print sprintf("%05d, %03.2f", 23, 4.5) }'
> > 00023, 4.50
> >
> > Does anyone ever had this problem? Should this be an AWK bug?
> > These codes were performed on mawk version 1.3.3-11.
> >
> > Best regards,
> >
> > Rodrigo Hjort
> >
> > http://rhjort.cjb.net/
> >
> > Linux User #348191 (http://counter.li.org)

#184 From: "Adam" <onzanews@...>
Date: Sat Aug 27, 2005 6:44 pm
Subject: Re: Formatting Problem with sprintf()
adam_onza
Offline Offline
Send Email Send Email
 
hello Rodrigo,
try
$ awk 'BEGIN{ print sprintf("%05d, %06.2f", 23, 4.5) }'
00023, 004.50

the '6' in "%06.2f" is the minimum width of the outputed float.
(including the decimal point and the fraction part.)
EG:
$ awk 'BEGIN{ print length(sprintf("%06.2f", 4.5)) }'
6

the 2 in "%06.2f" is the minimum width of the fraction part.
EGs:
pattern  output
"%06.2f" 004.50
"%06.3f" 04.500
"%06.4f" 4.5000
"%06.5f" 4.50000
"%06.6f" 4.500000

hope this helps
+m
za (Adam Onza)

--- In geeksthatgawk@yahoogroups.com, "Rodrigo Hjort"
<rodrigo_hjort@y...> wrote:
> Hi, AWK users!
>
> When using sprintf() to format float numbers with left padding zeroes,
> it doesn't work. For example, the output desired below should be
> "00023, 004.50".
>
> $ awk 'BEGIN{ print sprintf("%05d, %03.2f", 23, 4.5) }'
> 00023, 4.50
>
> Does anyone ever had this problem? Should this be an AWK bug?
> These codes were performed on mawk version 1.3.3-11.
>
> Best regards,
>
> Rodrigo Hjort
>
> http://rhjort.cjb.net/
>
> Linux User #348191 (http://counter.li.org)

#183 From: "Rodrigo Hjort" <rodrigo_hjort@...>
Date: Sun Aug 21, 2005 3:35 am
Subject: Formatting Problem with sprintf()
rodrigo_hjort
Offline Offline
Send Email Send Email
 
Hi, AWK users!

When using sprintf() to format float numbers with left padding zeroes,
it doesn't work. For example, the output desired below should be
"00023, 004.50".

$ awk 'BEGIN{ print sprintf("%05d, %03.2f", 23, 4.5) }'
00023, 4.50

Does anyone ever had this problem? Should this be an AWK bug?
These codes were performed on mawk version 1.3.3-11.

Best regards,

Rodrigo Hjort

http://rhjort.cjb.net/

Linux User #348191 (http://counter.li.org)

#182 From: "Jef" <jb2702000@...>
Date: Wed Jun 29, 2005 1:54 am
Subject: Re: tail -f and output redirection
jb2702000
Offline Offline
Send Email Send Email
 
The simplest way to answer your question, is that the first statement:
tail -f FILENAME | gawk '{ print $0 > "outfile"; print $0; }'

the output is only on the display and nothing is piped to gawk when
tail exits because that's the way tail works with the -f option.

When you run tail with a numeric argument like -100 as you did in:
tail -100 logfile | gawk '{ print $0 > "outfile"; print $0; }'

the output is immediately piped to gawk, because that's the way tail
works with a numeric argument. With the -f option, tail displays the
tip of the file, then waits for input, then displays the new tip, then
waits for input, and so on. When it exits, there is no output. Nothing
is piped to Gawk.

So, the easy way to do what you want is to runt these two (identical)
commands simmultaniously, in the same terminal:
tail -f logfile > outfile &
tail -f logfile

Now if you type:
echo foo
or
echo 1
echo 2
echo 3
...
you'll get the output the way you want it.
--- In geeksthatgawk@yahoogroups.com, "Jef" <jb2702000@y...> wrote:
> Actually, I made a mistake.
> If you type > instead of >> in
> tail -f temp >> outfile &
> (eg: tail -f temp > outfile &)
>
> The output in the first terminal matches
> cat outfile
>
> The point is, the out put from tail -f is static, but don't forget it
> redraws superfast every time you type echo foo on the other terminal.
> In other words if the input is 'foo', every time you type echo on the
> one terminal, the output of tail increases like this.
> foo         first echo
> foo foo     second echo
> foo foo foo third echo
>
> Because of this behaviour, | won't work when you use -f with tail,
> because there is nothing sent to the pipe.
>
> So, I guess to do what you want, you don't really need gawk anyway,
> bash will do the job if you run tail in the background and in the
> foreground.
>
> --- In geeksthatgawk@yahoogroups.com, "Jef" <jb2702000@y...> wrote:
> > Try this:
> > I made a file like this called temp
> > 1
> > 2
> > 3
> > 4
> > Then in one terminal I ran
> > tail -f temp >> outfile &
> >
> > Then in the same terminal I ran your code without the gawk statment
> > (the output from tail never gets there, so you don't need it. The
> > output is already been ouput on the terminal... there's nothing to
> > pipe to gawk):
> > tail -f temp
> >
> > Now, in a second terminal, I typed:
> > echo 5 >> temp
> >
> > And it showed up in the first terminal, of course.
> > In the second terminal, I typed:
> > cat outfile
> > 1
> > 2
> > 3
> > 4
> > 5
> >
> > There it is, but...
> > If you then type:
> > echo 6
> >
> > The output file now contains
> > cat outfile
> > 1
> > 2
> > 3
> > 4
> > 5
> > 1
> > 2
> > 3
> > 4
> > 5
> > 6
> >
> > See what I mean?
> > Gawk can do what you want to do, but not exactly. Not easily in a few
> > lines anyway.
> > Maybe Python, or Perl?
> > I don't know...
> > --- In geeksthatgawk@yahoogroups.com, "Jef" <jb2702000@y...> wrote:
> > > The reason is because tail, doesn't send it's output to gawk
until it
> > > finishes running. When you use -f, tail reads the file, then sits at
> > > the end of it waiting for more input, whenever some comes along, it
> > > displays it as you saw. However, when the program ends, that's
it, it
> > > just ends, so it pipes nothing into your file, which is verified by
> > > your file being empty. When you run list with -100, it reads
down the
> > > file, THEN it sends to the pipe as tail exits. Therefore, you
can read
> > > the file and see what you just echoed. But if you type, echo foo
> > > again, you won't see it in the outfile. That's cos' tails not
running.
> > > See what I mean. Its a cache 22.
> > > What you should do is just run the program for a period of time,
then
> > > stop it with ctrl-c, which outputs what you've collected to
'outfile',
> > > and start the program again. That way, outfile has all the new
entries
> > > for x hours.
> > > Cheers
> > > Jef
> > > --- In geeksthatgawk@yahoogroups.com, "luknowak23" <luknowak23@y...>
> > > wrote:
> > > > Hi,
> > > >
> > > > I have a problem with gawk, and I though you guys might help.
> > > > Here's the situation:
> > > >
> > > > I have an active logfile, which receives some lines from time to
> time.
> > > > I do:
> > > > tail -f logfile | gawk '{ print $0 > "outfile"; print $0; }'
> > > >
> > > > When I type from another console:
> > > > echo foo >> logfile
> > > >
> > > > I can see output on the screen, but nothing comes into the
> "outfile",
> > > > even though it gets created (zero length).
> > > >
> > > > When I run the same gawk script through:
> > > > tail -100 logfile | gawk '{ print $0 > "outfile"; print $0; }'
> > > >
> > > > everything is fine (there is output on the screen, and in the
> > > > "outfile")
> > > >
> > > > I really do not know what is going on, so please help me if
you can.
> > > > Many thanks.
> > > >
> > > > Lukasz

#181 From: "Jef" <jb2702000@...>
Date: Wed Jun 29, 2005 12:11 am
Subject: Re: tail -f and output redirection
jb2702000
Offline Offline
Send Email Send Email
 
Actually, I made a mistake.
If you type > instead of >> in
tail -f temp >> outfile &
(eg: tail -f temp > outfile &)

The output in the first terminal matches
cat outfile

The point is, the out put from tail -f is static, but don't forget it
redraws superfast every time you type echo foo on the other terminal.
In other words if the input is 'foo', every time you type echo on the
one terminal, the output of tail increases like this.
foo         first echo
foo foo     second echo
foo foo foo third echo

Because of this behaviour, | won't work when you use -f with tail,
because there is nothing sent to the pipe.

So, I guess to do what you want, you don't really need gawk anyway,
bash will do the job if you run tail in the background and in the
foreground.

--- In geeksthatgawk@yahoogroups.com, "Jef" <jb2702000@y...> wrote:
> Try this:
> I made a file like this called temp
> 1
> 2
> 3
> 4
> Then in one terminal I ran
> tail -f temp >> outfile &
>
> Then in the same terminal I ran your code without the gawk statment
> (the output from tail never gets there, so you don't need it. The
> output is already been ouput on the terminal... there's nothing to
> pipe to gawk):
> tail -f temp
>
> Now, in a second terminal, I typed:
> echo 5 >> temp
>
> And it showed up in the first terminal, of course.
> In the second terminal, I typed:
> cat outfile
> 1
> 2
> 3
> 4
> 5
>
> There it is, but...
> If you then type:
> echo 6
>
> The output file now contains
> cat outfile
> 1
> 2
> 3
> 4
> 5
> 1
> 2
> 3
> 4
> 5
> 6
>
> See what I mean?
> Gawk can do what you want to do, but not exactly. Not easily in a few
> lines anyway.
> Maybe Python, or Perl?
> I don't know...
> --- In geeksthatgawk@yahoogroups.com, "Jef" <jb2702000@y...> wrote:
> > The reason is because tail, doesn't send it's output to gawk until it
> > finishes running. When you use -f, tail reads the file, then sits at
> > the end of it waiting for more input, whenever some comes along, it
> > displays it as you saw. However, when the program ends, that's it, it
> > just ends, so it pipes nothing into your file, which is verified by
> > your file being empty. When you run list with -100, it reads down the
> > file, THEN it sends to the pipe as tail exits. Therefore, you can read
> > the file and see what you just echoed. But if you type, echo foo
> > again, you won't see it in the outfile. That's cos' tails not running.
> > See what I mean. Its a cache 22.
> > What you should do is just run the program for a period of time, then
> > stop it with ctrl-c, which outputs what you've collected to 'outfile',
> > and start the program again. That way, outfile has all the new entries
> > for x hours.
> > Cheers
> > Jef
> > --- In geeksthatgawk@yahoogroups.com, "luknowak23" <luknowak23@y...>
> > wrote:
> > > Hi,
> > >
> > > I have a problem with gawk, and I though you guys might help.
> > > Here's the situation:
> > >
> > > I have an active logfile, which receives some lines from time to
time.
> > > I do:
> > > tail -f logfile | gawk '{ print $0 > "outfile"; print $0; }'
> > >
> > > When I type from another console:
> > > echo foo >> logfile
> > >
> > > I can see output on the screen, but nothing comes into the
"outfile",
> > > even though it gets created (zero length).
> > >
> > > When I run the same gawk script through:
> > > tail -100 logfile | gawk '{ print $0 > "outfile"; print $0; }'
> > >
> > > everything is fine (there is output on the screen, and in the
> > > "outfile")
> > >
> > > I really do not know what is going on, so please help me if you can.
> > > Many thanks.
> > >
> > > Lukasz

#180 From: "Jef" <jb2702000@...>
Date: Tue Jun 28, 2005 11:43 pm
Subject: Re: tail -f and output redirection
jb2702000
Offline Offline
Send Email Send Email
 
Try this:
I made a file like this called temp
1
2
3
4
Then in one terminal I ran
tail -f temp >> outfile &

Then in the same terminal I ran your code without the gawk statment
(the output from tail never gets there, so you don't need it. The
output is already been ouput on the terminal... there's nothing to
pipe to gawk):
tail -f temp

Now, in a second terminal, I typed:
echo 5 >> temp

And it showed up in the first terminal, of course.
In the second terminal, I typed:
cat outfile
1
2
3
4
5

There it is, but...
If you then type:
echo 6

The output file now contains
cat outfile
1
2
3
4
5
1
2
3
4
5
6

See what I mean?
Gawk can do what you want to do, but not exactly. Not easily in a few
lines anyway.
Maybe Python, or Perl?
I don't know...
--- In geeksthatgawk@yahoogroups.com, "Jef" <jb2702000@y...> wrote:
> The reason is because tail, doesn't send it's output to gawk until it
> finishes running. When you use -f, tail reads the file, then sits at
> the end of it waiting for more input, whenever some comes along, it
> displays it as you saw. However, when the program ends, that's it, it
> just ends, so it pipes nothing into your file, which is verified by
> your file being empty. When you run list with -100, it reads down the
> file, THEN it sends to the pipe as tail exits. Therefore, you can read
> the file and see what you just echoed. But if you type, echo foo
> again, you won't see it in the outfile. That's cos' tails not running.
> See what I mean. Its a cache 22.
> What you should do is just run the program for a period of time, then
> stop it with ctrl-c, which outputs what you've collected to 'outfile',
> and start the program again. That way, outfile has all the new entries
> for x hours.
> Cheers
> Jef
> --- In geeksthatgawk@yahoogroups.com, "luknowak23" <luknowak23@y...>
> wrote:
> > Hi,
> >
> > I have a problem with gawk, and I though you guys might help.
> > Here's the situation:
> >
> > I have an active logfile, which receives some lines from time to time.
> > I do:
> > tail -f logfile | gawk '{ print $0 > "outfile"; print $0; }'
> >
> > When I type from another console:
> > echo foo >> logfile
> >
> > I can see output on the screen, but nothing comes into the "outfile",
> > even though it gets created (zero length).
> >
> > When I run the same gawk script through:
> > tail -100 logfile | gawk '{ print $0 > "outfile"; print $0; }'
> >
> > everything is fine (there is output on the screen, and in the
> > "outfile")
> >
> > I really do not know what is going on, so please help me if you can.
> > Many thanks.
> >
> > Lukasz

#179 From: "Jef" <jb2702000@...>
Date: Tue Jun 28, 2005 11:10 pm
Subject: Re: tail -f and output redirection
jb2702000
Offline Offline
Send Email Send Email
 
The reason is because tail, doesn't send it's output to gawk until it
finishes running. When you use -f, tail reads the file, then sits at
the end of it waiting for more input, whenever some comes along, it
displays it as you saw. However, when the program ends, that's it, it
just ends, so it pipes nothing into your file, which is verified by
your file being empty. When you run list with -100, it reads down the
file, THEN it sends to the pipe as tail exits. Therefore, you can read
the file and see what you just echoed. But if you type, echo foo
again, you won't see it in the outfile. That's cos' tails not running.
See what I mean. Its a cache 22.
What you should do is just run the program for a period of time, then
stop it with ctrl-c, which outputs what you've collected to 'outfile',
and start the program again. That way, outfile has all the new entries
for x hours.
Cheers
Jef
--- In geeksthatgawk@yahoogroups.com, "luknowak23" <luknowak23@y...>
wrote:
> Hi,
>
> I have a problem with gawk, and I though you guys might help.
> Here's the situation:
>
> I have an active logfile, which receives some lines from time to time.
> I do:
> tail -f logfile | gawk '{ print $0 > "outfile"; print $0; }'
>
> When I type from another console:
> echo foo >> logfile
>
> I can see output on the screen, but nothing comes into the "outfile",
> even though it gets created (zero length).
>
> When I run the same gawk script through:
> tail -100 logfile | gawk '{ print $0 > "outfile"; print $0; }'
>
> everything is fine (there is output on the screen, and in the
> "outfile")
>
> I really do not know what is going on, so please help me if you can.
> Many thanks.
>
> Lukasz

#178 From: "Jef" <jb2702000@...>
Date: Tue Jun 28, 2005 9:50 pm
Subject: Re: tail -f and output redirection
jb2702000
Offline Offline
Send Email Send Email
 
When I did it like this:
tail Bookmarks.html | gawk '{ print $0 > "outfile" }

It worked fine. The outfile was created and the last ten bookmarks
were there. But I don't know what the *&@# I'm doing so beware...
Cheers! Jef \ ( ^o^ ) /

#177 From: "Jef" <jb2702000@...>
Date: Tue Jun 28, 2005 8:58 pm
Subject: Re: [Geeks that Gawk] hi awk ai
jb2702000
Offline Offline
Send Email Send Email
 
Touche' Daniel
--- In geeksthatgawk@yahoogroups.com, "Daniel Ajoy" <dajoy@o...> wrote:
> On 13 Nov 2004 at 2:24, Adam wrote:
>
> > function or(x,y)
> > {
> >   if (x == 1 || y == 1 )
> >     return 1;  else return 0;
> > }
> >
>
> This could be:
>
> function or(x,y) { return x == 1 || y == 1 }
>
>
> Daniel

#176 From: "Jef" <jb2702000@...>
Date: Tue Jun 28, 2005 3:18 am
Subject: Re: hi awk ai
jb2702000
Offline Offline
Send Email Send Email
 
I guess I saw the same paper you did at:
http://www.cs.wustl.edu/~loui/sigplan
I was suprised that his students using Gawk faired better than those
using C++. There is a PDF that you can download about the project, but
I havn't done so. It's at:
http://portal.acm.org/citation.cfm?id=242903.242908
Maybe you can find some code there. I'm a newbie to gawk as well, so I
can't tell you much more than that. I found the information above on
Google.
--- In geeksthatgawk@yahoogroups.com, "Adam" <onzanews@e...> wrote:
>
> hello, I'm new to this group.
> I've read about using Awk for AI, but there are no sites with source
> code. has anyone seen or written such a thing?

#175 From: "luknowak23" <luknowak23@...>
Date: Mon Jun 20, 2005 7:54 pm
Subject: tail -f and output redirection
luknowak23
Offline Offline
Send Email Send Email
 
Hi,

I have a problem with gawk, and I though you guys might help.
Here's the situation:

I have an active logfile, which receives some lines from time to time.
I do:
tail -f logfile | gawk '{ print $0 > "outfile"; print $0; }'

When I type from another console:
echo foo >> logfile

I can see output on the screen, but nothing comes into the "outfile",
even though it gets created (zero length).

When I run the same gawk script through:
tail -100 logfile | gawk '{ print $0 > "outfile"; print $0; }'

everything is fine (there is output on the screen, and in the
"outfile")

I really do not know what is going on, so please help me if you can.
Many thanks.

Lukasz

#174 From: "Jef" <jb2702000@...>
Date: Tue Jun 28, 2005 3:00 am
Subject: New Member
jb2702000
Offline Offline
Send Email Send Email
 
Hi, I'm new to the group and just saying hello. I use RH9 on a Dell
and discovered Gawk in the info files. I've been using it a little,
and it's made me realize how much I need to learn about sys admin. I'm
gonna upgrade to Fedora or Slackware in the next coupla weeks. I'm
really interested to learn about what real sys admins do, and how they
use gawk to make it easier. Nuf' bout me. Thanks for having me here.

#173 From: "Nitallica" <artist@...>
Date: Tue May 24, 2005 5:20 pm
Subject: Moderation
nitallica
Offline Offline
Send Email Send Email
 
Starting today all new members will be moderated by default.  If/When
he/she posts for the first time, then he/she will gain full posting
privileges after I have reviewed the message and granted posting access.

This should have been implemented months ago, but I had hoped to avoid
this measure.  My apologies to all current members.

#171 From: kachapuram nagaraju <naghems@...>
Date: Mon Apr 18, 2005 4:10 am
Subject: Re: [Geeks that Gawk] Awesome Directory
naghems
Offline Offline
Send Email Send Email
 
May i know who are you?

--nag

kate_telecom <kate_telecom@...> wrote:

Hello there,

Try visiting this well listed Directory on Computers and Internet! ...

Here is the link http://hi-fiweb.com/comp

Hoping to learn a lot from other group members.

Take care,
Anju






---------------------------------
Yahoo! Groups Links

    To visit your group on the web, go to:
http://groups.yahoo.com/group/geeksthatgawk/

    To unsubscribe from this group, send an email to:
geeksthatgawk-unsubscribe@yahoogroups.com

    Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



---------------------------------
Do you Yahoo!?
  Plan great trips with Yahoo! Travel: Now over 17,000 guides!

[Non-text portions of this message have been removed]

#170 From: "kate_telecom" <kate_telecom@...>
Date: Sat Apr 16, 2005 2:03 am
Subject: Awesome Directory
kate_telecom
Offline Offline
Send Email Send Email
 
Hello there,

Try visiting this well listed Directory on Computers and Internet! ...

Here is the link http://hi-fiweb.com/comp

Hoping to learn a lot from other group members.

Take care,
Anju

#169 From: kachapuram nagaraju <naghems@...>
Date: Mon Mar 21, 2005 4:09 pm
Subject: Re: [Geeks that Gawk] What is a blog?
naghems
Offline Offline
Send Email Send Email
 
Hello dear...

blog is nothing but ... weblogs.. in this all
individuals thoughts are written... its short form is
(we)blog... ok dear

do reply at ur convience.. am nagaraj, india, m/27
working for Life insurance corporation of india.. and
i like programming in AWK...

bye



__________________________________
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/

#168 From: "caralee859l" <caralee859l@...>
Date: Mon Mar 21, 2005 12:28 pm
Subject: What is a blog?
caralee859l
Offline Offline
Send Email Send Email
 
I found this url surfing, http://blogs.ardice.com
But can someone explain to me what a blog is?   -   Caralee859l

#167 From: kachapuram nagaraju <naghems@...>
Date: Fri Mar 18, 2005 5:38 pm
Subject: Re: [Geeks that Gawk] Check this awesome Online Directory
naghems
Offline Offline
Send Email Send Email
 
hello ramya .. do reply... am a awk programmer
nagaraju
--- ramya_s05 <ramya_s05@...> wrote:
>
> Hello,
>
> I just happen to go through a very simple page, with
> relavent links on
> computing and felt that it could be useful to you
> too. You may go to
> http://hi-fiweb.com/2005/directories/computing for
> the Computing catalog.
>
> Megha
>
>
>
>



__________________________________
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/

#164 From: kachapuram nagaraju <naghems@...>
Date: Sat Feb 26, 2005 12:21 pm
Subject: Re: [Geeks that Gawk] I'm new to this group
naghems
Offline Offline
Send Email Send Email
 
hello welcome to the group... my name is nagraj.. working for LIC of india.. u
can mail ur doubts to naghems@...

bye
nagraj

caralee859l <caralee859l@...> wrote:

http://www.ardice.com/Computers/Programming/Languages/Awk/
Hello, I found this group at this website.




Yahoo! Groups SponsorADVERTISEMENT


---------------------------------
Yahoo! Groups Links

    To visit your group on the web, go to:
http://groups.yahoo.com/group/geeksthatgawk/

    To unsubscribe from this group, send an email to:
geeksthatgawk-unsubscribe@yahoogroups.com

    Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



---------------------------------
Do you Yahoo!?
  Read only the mail you want - Yahoo! Mail SpamGuard.

[Non-text portions of this message have been removed]

#163 From: "caralee859l" <caralee859l@...>
Date: Fri Feb 25, 2005 1:11 pm
Subject: I'm new to this group
caralee859l
Offline Offline
Send Email Send Email
 
#162 From: "Adam" <onzanews@...>
Date: Thu Nov 25, 2004 3:42 am
Subject: Re: [Geeks that Gawk] what can we do about recent SPAM on the list
adam_onza
Offline Offline
Send Email Send Email
 
once on another group, I found a certain virus had been spamming the
list. I didn't have it, but I investigated the e-mail text (on the
website.) and discovered it's identity. it was while the owner was on
vacation too, I think... it was kinda sad, because they resigned a
short time after. I think it was because of that. I TRIED very hard to
be polite when I told them about it... :(

my point is, that maybe the spams are being sent by someone other than
the members. (maybe some of them are even innocent.) if that virus
could fake all those emails from members, then so could a spammer.
(with the right tools and maybe zombies.)

I have not seen these spams, so I don't know what kind of spam they
were, or what was responsable for sending them. so I really shouldn't
talk, but I just wanted to voice the concern.

good luck
+m
za  (Adam Onza)

--- In geeksthatgawk@yahoogroups.com, nitallica@y... wrote:
>
> --- In geeksthatgawk@yahoogroups.com, "Albert Bickford"
> <bickford@v...> wrote:
> >
> >
> > Question:
> >
> > Who is the moderator of this list and has control over it?  Is
> there
> > anything that can be done to prevent SPAM postings such as the ones
> we've
> > been getting recently?  If this continues, the list will be ruined.
>  I, for
> > one, will remove my name from the list if the SPAM traffic
> incrreases, and I
> > suspect that others will too.
>
>
> I am the owner of this group and only moderator.  My apologies for the
> delayed deletion, banning, and reporting of the spammer as I have been
> on holiday and did not have internet access.
>
>
> >
> > As to what can be done: Can the list be set to only accept postings
> from
> > members of the list?
>
>
> It is already set this way.
>
>
> > If necessary, could all postings be moderated, so only
> > one person has to deal with the junk that comes through?
> >
>
>
> The problem is that I do not get online as much as I'd like which
> would cause even good/valid messages to sit until I can get to them.
>
>
>
> > If no one speaks up as moderator, should we see if one of those of
> us who
> > are actively reading it could be made the moderator?
>
>
> I am currently looking for someone to help moderate this list.  Any
> who are interested please feel free to contact me.

#161 From: nitallica@...
Date: Fri Nov 19, 2004 11:31 pm
Subject: Re: [Geeks that Gawk] what can we do about recent SPAM on the list
nitallica
Offline Offline
Send Email Send Email
 
--- In geeksthatgawk@yahoogroups.com, "d_godfrey2000" <don-g@n...> wrote:
>
> I'd also like to find a way to stop the spam that is being sent
> through this group.
> From checking the members list, it appears no one is listed as the
> moderator.
> I'd be willing to spend some time helping keep this group running for
> the benefit of members, but I've never acted as a moderator for an on-
> line group.
> The first question I have is 'what are all of the tasks of a
> moderator'?


It would depend on what abilities are set for you.  This would include
something like deleting messages, approving new messages (if we switch
to a moderated forum), deleting/banning members, ...


> Secondly, addressing the issue of the spam we are getting, it seems
> it would be beneficial to allow outsiders to post their legit
> questions - & often the questions are time-sensitive, so if we force
> all posters to join, someone will need to be able to 'accept
> membership' in a timely manner.
> What if we had co-moderators? Having 2 or 3 co-moderators may reduce
> problems with timeliness. Is anyone willing to act as co-moderator
> with me?
>
> --- In geeksthatgawk@yahoogroups.com, "Albert Bickford"
> <bickford@v...> wrote:
> >
> >
> > Question:
> >
> > Who is the moderator of this list and has control over it?  Is
> there
> > anything that can be done to prevent SPAM postings such as the ones
> we've
> > been getting recently?  If this continues, the list will be
> ruined.  I, for
> > one, will remove my name from the list if the SPAM traffic
> incrreases, and I
> > suspect that others will too.
> >
> > As to what can be done: Can the list be set to only accept postings
> from
> > members of the list?  If necessary, could all postings be
> moderated, so only
> > one person has to deal with the junk that comes through?
> >
> > If no one speaks up as moderator, should we see if one of those of
> us who
> > are actively reading it could be made the moderator?
> >
> > --Albert
> >
> > Albert Bickford

#160 From: nitallica@...
Date: Fri Nov 19, 2004 11:28 pm
Subject: Re: [Geeks that Gawk] what can we do about recent SPAM on the list
nitallica
Offline Offline
Send Email Send Email
 
--- In geeksthatgawk@yahoogroups.com, "Albert Bickford"
<bickford@v...> wrote:
>
>
> Question:
>
> Who is the moderator of this list and has control over it?  Is
there
> anything that can be done to prevent SPAM postings such as the ones
we've
> been getting recently?  If this continues, the list will be ruined.
  I, for
> one, will remove my name from the list if the SPAM traffic
incrreases, and I
> suspect that others will too.


I am the owner of this group and only moderator.  My apologies for the
delayed deletion, banning, and reporting of the spammer as I have been
on holiday and did not have internet access.


>
> As to what can be done: Can the list be set to only accept postings
from
> members of the list?


It is already set this way.


> If necessary, could all postings be moderated, so only
> one person has to deal with the junk that comes through?
>


The problem is that I do not get online as much as I'd like which
would cause even good/valid messages to sit until I can get to them.



> If no one speaks up as moderator, should we see if one of those of
us who
> are actively reading it could be made the moderator?


I am currently looking for someone to help moderate this list.  Any
who are interested please feel free to contact me.

#158 From: "Daniel Ajoy" <dajoy@...>
Date: Sat Nov 13, 2004 7:21 pm
Subject: Re: [Geeks that Gawk] hi awk ai
daniel_ajoy
Offline Offline
Send Email Send Email
 
On 13 Nov 2004 at 2:24, Adam wrote:

> function or(x,y)
> {
>   if (x == 1 || y == 1 )
>     return 1;  else return 0;
> }
>

This could be:

function or(x,y) { return x == 1 || y == 1 }


Daniel

Messages 158 - 191 of 221   Newest  |  < Newer  |  Older >  |  Oldest
Advanced
Add to My Yahoo!      XML What's This?

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help