in reply to Re^3: Sort Large Files
in thread Sort Large Files
Did you actually try those? I suspect not, because you'd need an "eval" in your script to get the shell to do another round of whitespace parsing after the variable is interpolated, and that's a Very Good Thing. As it is, you'd be trying to cat the current directory (garbage in garbage out), a file named "data1 data2" and probably get some switch violation because it'd be a single weird switch with a lot of odd chars in it.file="" file="data1 data2" file="-s squeeze-my-blanks"
In this particular pipeline, $file could have been placed after the perl command (if you can assume $file doesn't have a switch for cat). However, that would place the data to act on somewhere in the middle of the pipeline. Which I find harder to understand. Flow should go from right to left, left to right, top to bottom, or bottom to top. But not middle, left, right. cat is short, just three letters, which places the data nearly at the beginning.Nobody is saying violate the order. Write it like this if you want it left to right:
I hand out the Useless Use of Cat Award precisely because of code like yours, where a cat is indeed completely useless.< $file \ perl ... | other ... | nextthing ... | and_so_on ...
-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Sort Large Files
by Anonymous Monk on Jan 06, 2005 at 14:40 UTC | |
by merlyn (Sage) on Jan 06, 2005 at 14:48 UTC | |
by Anonymous Monk on Jan 06, 2005 at 15:38 UTC | |
by tye (Sage) on Jan 06, 2005 at 16:22 UTC | |
by Anonymous Monk on Jan 07, 2005 at 09:32 UTC | |
by csh (Novice) on Jan 14, 2005 at 21:49 UTC | |
|
Re^5: Sort Large Files
by jdporter (Paladin) on Mar 21, 2005 at 04:19 UTC |