Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
04-28-2003, 09:56 AM
|
#1
|
Senior Member
Registered: Jan 2003
Location: Aachen
Distribution: Opensuse 11.2 (nice and steady)
Posts: 2,203
Rep:
|
awk files
What are the differences between the 2 awk files . ¶I can not find them
|
|
|
04-28-2003, 03:11 PM
|
#2
|
Moderator
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
|
HUH?
Which files, what are you talking about?
Cheers,
Tink
|
|
|
04-28-2003, 03:38 PM
|
#3
|
Senior Member
Registered: Jan 2003
Location: Aachen
Distribution: Opensuse 11.2 (nice and steady)
Posts: 2,203
Original Poster
Rep:
|
oups
oups i dit it again
A) /^$/ {
print x += 1
}
Â) /^$/ {
print x++
}
|
|
|
04-28-2003, 03:47 PM
|
#4
|
Moderator
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
|
Kalimera! :)
I'm not an expert in awk <grin> but
in C/C++ "x += 1" and "x++" can be
used synonymously...
Cheers,
Tink
|
|
|
04-29-2003, 02:18 PM
|
#5
|
Senior Member
Registered: Jan 2003
Location: Aachen
Distribution: Opensuse 11.2 (nice and steady)
Posts: 2,203
Original Poster
Rep:
|
ouaou
where are u from tinkster?
Geia sou ellada!!
|
|
|
04-29-2003, 02:38 PM
|
#6
|
LQ Guru
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018
Rep:
|
It looks like they're both the same. In C/C++, at least, I think they'd do the same thing.
print x++ prints x, then increments (post-increment, they call it)
print ++x increments x, then prints (pre-increment I guess)
Don't know if the same applies in awk though.
|
|
|
04-29-2003, 03:18 PM
|
#7
|
Moderator
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
|
Re: ouaou
Quote:
Originally posted by alaios
where are u from tinkster?
Geia sou ellada!!
|
Living in New Zealand :)
But I used to do classical greek at Uni,
and spent a beautiful holiday in the
greek part of Cyprus once :}
Yassou,
Tink
|
|
|
05-13-2003, 05:56 AM
|
#8
|
Member
Registered: Jul 2002
Location: Germany
Distribution: Redhat 7.3, Debian 3.1, Knoppix 3.1, Ubuntu 6.10
Posts: 113
Rep:
|
hi alaios,
"print x +=1;" is same as "print ++x;" or "print x =x+1;" whereas "print x++" could be substituted by "print x +=0;" or "print x =x+0;"
Hope you get the idea.
A) /^$/ {
print x += 1
}
B) /^$/ {
print x++
}
Thus A would print the number of empty lines beginning with 1 whereas B would begin with 0.
Last edited by realos; 12-15-2006 at 06:29 AM.
|
|
|
All times are GMT -5. The time now is 11:29 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|