Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re^2: Command line file sorting

by swkronenfeld (Hermit)
on Sep 05, 2007 at 18:34 UTC ( #637234=note: print w/replies, xml ) Need Help??

in reply to Re: Command line file sorting
in thread Command line file sorting


Thanks. I was playing with sort earlier, and was unable to make this work properly. Your solution still has one problem that I need to address, something that I didn't mention above. If there is only one entry, the entry sometimes* gets printed, but I need that result to be empty. Is there an easy way to do this from the shell?

* - I say sometimes, because on bash under linux, it does not get printed due to an extra blank line that somehow gets generated in the output. On AIX and MacOS X, the entry gets printed.

Replies are listed 'Best First'.
Re^3: Command line file sorting
by artist (Parson) on Sep 05, 2007 at 19:15 UTC
    Following should not print anything, if there is no data in the 2nd line.
    cat data | awk NR==2

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://637234]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2022-12-03 18:30 GMT
Find Nodes?
    Voting Booth?

    No recent polls found