News for hackers. Stuff that matters.
Re:C++ has become a scripting language by MereInterest on Wednesday October 16, 2013 @08:26AM (#6559214)
Yeah, the bash variant is obscenely short as well. Short enough that it isn't worth having as a separate program.

    cat in.txt | sort > out.txt
Re:C++ has become a scripting language by femto on Wednesday October 16, 2013 @08:36AM (#6559269)
Curious, in case I'm missing something. Is what you've written equivalent to the following, or is there a reason for the pipe?

sort in.txt > out.txt

Re:C++ has become a scripting language by Someone on Wednesday October 16, 2013 @02:38PM (#6561321)
For those that don't know: there is/was an ancient meme called the "Useless Use of Cat Award" about that subject. See for instance http://en.wikipedia.org/wiki/Cat_(Unix)#Useless_use_of_cat, http://partmaps.org/era/unix/award.html, or http://unix.stackexchange.com/questions/16279/should-i-care-...
Re:C++ has become a scripting language by MereInterest on Wednesday October 16, 2013 @08:43AM (#6559310)
From the other comment, it is completely equivalent, and I will admit that the pipe is due purely to my ignorance. I usually use `sort` for sorting the output of other commands, and so I forget that it can open a file on its own.
Re:C++ has become a scripting language by reycharles on Wednesday October 16, 2013 @12:45PM (#6560665)
That usage of cat is "wrong" in general:

    cat file | command > out
is the same as

    command < file > out
Re:C++ has become a scripting language by rat87 on Thursday October 17, 2013 @03:13AM (#6564037)
Don't worry about the cat it does have a purpose: portability. cat in.txt | sort > out.txt works in powershell(cat is an alias for Get-Content and sort is an alias for sort-object)(without the sort it wouln't work).
Re:C++ has become a scripting language by 1_player on Wednesday October 16, 2013 @08:32AM (#6559244)
No need for cat!

    sort in.txt > out.txt
Re:C++ has become a scripting language by skriticos2 on Wednesday October 16, 2013 @08:43AM (#6559313)
We are talking about a script, so it should be:

cat $1 | sort > $2