[Ilugc] .a-tip-a-day. xargs command

  • From: rmathews@xxxxxxxxx (Roshan Mathews)
  • Date: Mon Sep 21 11:44:22 2009

On Mon, Sep 21, 2009 at 10:19 AM, Kapil Hari Paranjape
<kapil@xxxxxxxxxxx> wrote:

On Mon, 21 Sep 2009, Venkatraman S wrote:
On Sat, Sep 19, 2009 at 5:04 AM, Girish Venkatachalam <
girishvenkatachalam@xxxxxxxxx> wrote:

$ find /etc -type f | xargs vi
Also, when i tried it with 5 files(txt), my cmd line got screwed up - as in,
the keymaps werent working - up, down arrows were not responding. (is this
only me or reproducible?)
I got the same results which leads me to suspect that the original
tip is faulty.

The tip may not be faulty.  /etc might have a tons of files, which
means your command line would go past the limit.  Try find with a
-print0 option and xargs with a -0 flag ... this way, it uses the
stdin/stdout for passing stuff around going around the command line
limit.

This may not be a portable flag though, should work on GNU.

Secondly, got editor trouble?  Check out http://www.gnu.org/software/emacs/

Roshan

Other related posts: