Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: Command line file sorting

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


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

artist

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
    --Artist

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (8)
As of 2024-04-19 08:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found