doubt

This is a discussion on doubt within the awk forums in Programming Languages category; Hello, I have a file with more then 1000 lines but I would like to get only the odd lines of this file.. or the inverse the even lines of this file. How can I do that with AWK? Thank you in advance...

Go Back   Application Development Forum > Programming Languages > awk

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-13-2008, 01:38 PM
Minalba Jordao
Guest
 
Default doubt

Hello,

I have a file with more then 1000 lines

but I would like to get only the odd lines of this file.. or the
inverse the even lines of this file.

How can I do that with AWK?

Thank you in advance
Reply With Quote
  #2  
Old 08-13-2008, 01:59 PM
Minalba Jordao
Guest
 
Default Re: doubt

Ops..
I found out how to do it:
awk '!(NR%2)' file
or
the inverse
awk '(NR%2)' file

Thank you anyway

On Aug 13, 2:38 pm, Minalba Jordao <minalbajor...@gmail.com> wrote:
> Hello,
>
> I have a file with more then 1000 lines
>
> but I would like to get only the odd lines of this file.. or the
> inverse the even lines of this file.
>
> How can I do that with AWK?
>
> Thank you in advance


Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 03:43 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.