Re: select alternative lines from a file

<gopikrishnan.gunasekaran@xxxxxxxxx> wrote in message news:1139592499.348584.295390@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
: hi all,
: Im using the following script to select alternative lines from a file.
: cat -n <filename> | awk '{ if ($1%2 =0) print $0)
: its output contains the line number but i dont want it, Anyone help me
: in this regard
: Thanks & Regards,
: Gopi Krishnan

To output even numbered lines

awk '!(NR%2)' filename # parentheses necessary since ! has precedence over %

To output odd numbered lines

awk 'NR%2' filename # parentheses necessary since ! has precedence over %

Dan Mercer


Relevant Pages

  • Re: [PHP] Passing vars w/refresh w/register globals off?
    ... Dont know why you want to, ... This wasy all you need is pass the ID within the browser. ... > switch for routing to desired pages according to form input data. ... I'm thinking the old script would be php3 and the new ...
  • Re: Looking for maybe impossible script?
    ... The admin rights on the laptops were ... Even if i could get a script that would notify me of such ... I just dont have the time. ... aide fix and tracing them down to the port an then shuting it off. ...
  • Re: Running Login Script after establishing a VPN connection
    ... I dont know what you mean by a "pure batch command". ... "Pegasus (MVP)" wrote: ... This would be equivalent to your current VB Script program ... The network drive disconnects before the bat file ...
  • Re: Logs remote ip when connects to exchange, ftp, or remotly to s
    ... Thanks for your help I wont argue anymore. ... I appreciate everything now I am looking for a script to extract ... >> server through remote desktop on the desktop of his server it showed the ... I just dont know how to make this script see I am going to ...
  • Re: [Full-disclosure] reduction of brute force login attempts via SSHthrough iptables --
    ... Anyhow its no problem at all to modify, so if you dont like it, just dont use it. ... on a lame script like this as long as it WORKS and is not insecure. ... echo "~ sorting out ip by ip" ... # echo "not enough failed logins, probably no attack from: ...