in reply to -i switch behaviour
-i replaces the files given as @ARGV inplace, and <> is an iterator over the contents of each of these files. If @ARGV is empty, STDIN is used to supply the contents, not to supply the list of filename(s). So your -e code is applied to the list of files itself, not to the contents of these files. And it can't then use the result to do an update, since there actually is no file that that the list is the contest of.
That's of course the case in general. There is no reason to think STDIN is associated with a file (in your case it's a pipe), so a rewrite of that "file" makes no sense. And that's also what makes xargs so nice. It allows you to convert an inputstream to a list of arguments.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: -i switch behaviour
by fireartist (Chaplain) on Jun 18, 2004 at 14:01 UTC |