LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Closed Thread
  Search this Thread
Old 12-28-2007, 05:47 AM   #16
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985

the reason YOU should know how to run an awk file is because YOU know how to use man pages and documentation. you appear to make very little effort to find these things out for yourself. you should also be much more than capable of finding out how awk relates to nawk and gawk. how about you telling us what the differences are by your own research?

Last edited by acid_kewpie; 12-28-2007 at 05:48 AM.
 
Old 12-28-2007, 06:06 AM   #17
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,697
Blog Entries: 5

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally Posted by Gins View Post
The problem is there are so many programming languages and other stuff in the domain of computer science.
That is not a problem. The problem lies with you and the decisions you make.

Quote:
Who on earth can learn all those languages and other stuff?
Nobody asked you to learn all. If you want to do that, by all means. If you can't then, pick one ( whatever your criteria for choosing is ) and start learning.

Quote:
Now I have learnt there are other flavours of awk. They are gawk and nawk.
And many others. Check AWK's wiki, if you know what that is.

Quote:
I believe you are all working with Sed and Awk from time to time. If it is the case, you are somewhat familiar with all the nuances.
Not all. Its all a matter of choosing your tools to work with for different situations.
 
Old 12-28-2007, 06:14 AM   #18
AnanthaP
Member
 
Registered: Jul 2004
Location: Chennai, India
Posts: 952

Rep: Reputation: 217Reputation: 217Reputation: 217
cat <Inputfilename1> <inputfilename2> .. | awk -f average-awk.c
or else
awk -f average-awk.c <Inputfilename1> <inputfilename2> ..

Some points for the OP.
(1) You are running the awk program.
(2) Giving the extension .c means nothing to linux. Its just a holdover from old times.
(3) The program script could have been called average_awk.script or anything.anythingelse
(4) Awk accepts program scripts and files (data files) in the command line.

So
awk -f awk_script_name (could be average.awk, anthing.anythingelse) then data files

C is a totally diferent language.
The C file contains C language english like instructions. By a separate compile process (usually cc), which we create an executable file (zeros and ones) having the same logic as your original program. (The default is a.out and can be renamed to average_awk.exe or average-awk.executable). This is given execute rights and is actually executed.

All the best in your programming journey.

End
 
Old 12-28-2007, 06:29 AM   #19
Gins
Senior Member
 
Registered: Jul 2004
Location: Germany
Distribution: open SUSE 11.0, Fedora 7 and Mandriva 2007
Posts: 1,662

Original Poster
Rep: Reputation: 47
I thank acid_kewpie , ghostdog and AnanthaP for the replies.

You are all clever at awk, sed, shell scripting and other prgramming languages.

It is my stupidity that I don't read the related literature. I eat humble pie.

I recognize acid_kewpie for a several years. You are clever at UNIX. I think I told you that I hate to read the man pages. For me it is written in a boring manner. You are British. So you know better English than me.

There are other websites, for example the materials you have mentioned here, are written in attractive language. I read a part of them. I will read more when time permits.

Last edited by Gins; 12-28-2007 at 06:31 AM.
 
Old 12-28-2007, 12:23 PM   #20
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
you find reading English boring, so you expect us to recite English to you??? do you have any idea how insulting that sounds?

Whilst not as much as for English, there is a LOT of German text about awk... http://www.google.de/search?hl=de&q=...a=lr%3Dlang_de

i really hope no one is paying you money for your technical knowledge.
 
Old 12-28-2007, 03:40 PM   #21
Gins
Senior Member
 
Registered: Jul 2004
Location: Germany
Distribution: open SUSE 11.0, Fedora 7 and Mandriva 2007
Posts: 1,662

Original Poster
Rep: Reputation: 47
acid_kewpie
Thanks for taking time again to reply me.
I did not say reading English is boring. I love to read English. I have bought a lot of books on computer subjects.

When I studied Cisco neworking course, all the books needed for the course were in English. I have big collection of Cisco Systems. I have spent thousands of money to buy them. They are written in beautiful and simple English.

In my opinion, so-called man pages were written in a way that people get fed up of them.
For me, the websites you are all have mentioned were written in beautiful and simple English.

Last edited by Gins; 12-28-2007 at 03:41 PM.
 
Old 12-29-2007, 04:17 AM   #22
AnanthaP
Member
 
Registered: Jul 2004
Location: Chennai, India
Posts: 952

Rep: Reputation: 217Reputation: 217Reputation: 217
Hey gins,

In my case, it isn't about your english. It is about your basic assumption (.c extension and all of it) and my understanding of what you need to do.

I think that you should talk to somebody who introduced you to all this and review your entire approach (technically speaking) to using awk, c etc from first principles.

End
 
Old 12-29-2007, 09:55 AM   #23
Gins
Senior Member
 
Registered: Jul 2004
Location: Germany
Distribution: open SUSE 11.0, Fedora 7 and Mandriva 2007
Posts: 1,662

Original Poster
Rep: Reputation: 47
Thanks AnanthaP

Indians are clever at computer science.
 
Old 12-29-2007, 02:34 PM   #24
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally Posted by PAix View Post
Code:
awk-f average_awk.c
Not your day I'm afraid Gins.
Make that not his last three years of using Linux... he refuses to
read man-pages consistently, and doesn't seem too good with using
google for information retrieval, either.





Cheers,
Tink

Last edited by Tinkster; 12-29-2007 at 02:58 PM. Reason: too, not to
 
Old 12-29-2007, 03:15 PM   #25
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
Quote:
Originally Posted by Gins View Post
Thanks AnanthaP

Indians are clever at computer science.
but AnathaP has said nothing whatsoever about computer science there, just common sense, as i'm sure he'd agree...
 
Old 12-29-2007, 10:32 PM   #26
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,697
Blog Entries: 5

Rep: Reputation: 244Reputation: 244Reputation: 244
I think our job is done here, right?
 
Old 12-29-2007, 11:15 PM   #27
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally Posted by ghostdog74 View Post
I think our job is done here, right?
Depends on how we define "our job". I always hoped it was to
empower people to help themselves - in which case we're failing
because of the resilience of the subject to learning. :}

If "our job" is a quick fix every time he runs into a problem
and refuses to read or research ... yes, you're done! ;}



Cheers,
Tink
 
Old 12-29-2007, 11:38 PM   #28
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,697
Blog Entries: 5

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally Posted by Tinkster View Post
Depends on how we define "our job". I always hoped it was to
empower people to help themselves - in which case we're failing
because of the resilience of the subject to learning. :}

If "our job" is a quick fix every time he runs into a problem
and refuses to read or research ... yes, you're done! ;}



Cheers,
Tink
you guys put in too much dedication. :-)
I suggest we leave him to be, and enjoy a good weekend instead.
 
Old 12-30-2007, 04:58 AM   #29
PAix
Member
 
Registered: Jul 2007
Location: United Kingdom, W Mids
Distribution: SUSE 11.0 as of Nov 2008
Posts: 195

Rep: Reputation: 40
To clarify, the original version of awk was a bit limited to say the lest and was replaced by nawk (new awk) somewhere between 1985 and 1989. Solaris ships with both awk and nawk. Most other distributions seem to ship with either nawk renamed as awk or gawk, sometimes also referred to as awk (I believe). I'm pretty sure that what you are after is NOT the original version of awk which doesn't handle floating point arithmetic and is missing a lot of later functionality. In an out of the box Solaris solution, nawk should be your choice. Gawk (Gnu awk) is preferable, but as others have said portability is a real consideration. No point in developing under Gawk and then expecting your code to work under nawk on a Solaris box.

You just won't be able to learn all the languages available the way you might want to. Decide that shaped and sized pool you wish to occupy and dig it to suit. Specialise in that gives you most advantage in terms of work and enjoyment and gain a sufficiency of familiarity with some of the others so that you know when it's time to return and improve your skills to give you more advantages. One thing is sure, there is no reason for you to be out wasting your time on the streets, there is more than enough in the way of languages etc to keep you busy for a few years yet All good fun.
I Hope you had a good Christmas and are all set for a Happy New Year - and to the readers and valued forum contributers.
 
Old 12-30-2007, 07:01 AM   #30
Gins
Senior Member
 
Registered: Jul 2004
Location: Germany
Distribution: open SUSE 11.0, Fedora 7 and Mandriva 2007
Posts: 1,662

Original Poster
Rep: Reputation: 47
Thanks everybody for the comments.

PAix, I am running open SuSE. I think it is either 10.0 or 10.1. I know there are new releases. I didn't give a thought of upgrading yet. Because it works fine. Of course I have working Mandriva and Fedora Core. Sometimes I look at them.

When the computer starts, I can select openSuSE, Mandriva or Fedora Core. GRUB does the job.

There is a small problem of switching to the other distros. The cable modem refuse to recognize when I come back to open SuSE.

I must disconnect the power of the modem and wait for a few minutes and reboot the computer. This is time consuming. Though I like Mandriva and Fedora Core, I don't want to look at them.

I talked to my ISP. You know they support only Windows problems. They no nothing about open source.

I have 24MB per second data transfer. It is the highest speed in this area. In some parts of the country people get 100MB per second too.

How do I find out whether I have awk,gawk,nawk, etc. ?

Last edited by Gins; 12-30-2007 at 07:02 AM.
 
  


Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:58 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration