LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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


Reply
  Search this Thread
Old 04-28-2003, 09:56 AM   #1
alaios
Senior Member
 
Registered: Jan 2003
Location: Aachen
Distribution: Opensuse 11.2 (nice and steady)
Posts: 2,203

Rep: Reputation: 45
awk files


What are the differences between the 2 awk files . ¶I can not find them
 
Old 04-28-2003, 03:11 PM   #2
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
HUH?


Which files, what are you talking about?


Cheers,
Tink
 
Old 04-28-2003, 03:38 PM   #3
alaios
Senior Member
 
Registered: Jan 2003
Location: Aachen
Distribution: Opensuse 11.2 (nice and steady)
Posts: 2,203

Original Poster
Rep: Reputation: 45
Talking oups

oups i dit it again





A) /^$/ {
print x += 1
}


Â) /^$/ {
print x++
}
 
Old 04-28-2003, 03:47 PM   #4
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
Kalimera! :)

I'm not an expert in awk <grin> but
in C/C++ "x += 1" and "x++" can be
used synonymously...

Cheers,
Tink
 
Old 04-29-2003, 02:18 PM   #5
alaios
Senior Member
 
Registered: Jan 2003
Location: Aachen
Distribution: Opensuse 11.2 (nice and steady)
Posts: 2,203

Original Poster
Rep: Reputation: 45
ouaou

where are u from tinkster?
Geia sou ellada!!
 
Old 04-29-2003, 02:38 PM   #6
wapcaplet
LQ Guru
 
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018

Rep: Reputation: 48
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.
 
Old 04-29-2003, 03:18 PM   #7
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
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
 
Old 05-13-2003, 05:56 AM   #8
realos
Member
 
Registered: Jul 2002
Location: Germany
Distribution: Redhat 7.3, Debian 3.1, Knoppix 3.1, Ubuntu 6.10
Posts: 113

Rep: Reputation: 15
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.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Split large file in several files using scripting (awk etc.) chipix Programming 14 10-29-2007 11:16 AM
writing awk script files bigmark Linux - Software 1 10-19-2005 10:33 AM
split files using awk (or similar) lgualteri Programming 1 06-13-2005 09:17 AM
awk cli to rename a list of files... pld Linux - General 4 02-15-2005 10:57 PM
Retrieving variables from contents of files using awk or any other bash tool genderbender Programming 8 01-21-2005 03:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:22 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