Kevin Vance (weblog of)

Entries | Archive | Friends | Friends' Friends | User Info

03:08 am

Friday, September 3rd, 2010
Previous Entry Add to Memories Share Next Entry
Thanks, GNU project. Thanks for this:
xargs sh -c 'emacs "$@" < /dev/tty' emacs

Launches the minimum number of copies of Emacs needed, one after the other, to edit the files listed on xargs' standard input. This example achieves the same effect as BSD's -o option, but in a more flexible and portable way.
It is a great relief to know how flexible and portable GNU xargs is every time I have to look up that incantation in the man page. Taunting me with BSD xargs' -o option is an especially nice touch.

Current Mood elated
Current Music Mick Rippon - Existing
Link )Reply )

Comments
[User Picture]From: peadarog
2010-09-03 12:34 pm (UTC)

(Link)

It's the favourite command of the data pirates: xarrrrrgs
From: ole.tange.dk
2010-09-05 11:46 pm (UTC)

More readable using GNU Parallel

(Link)

If you have GNU Parallel http://www.gnu.org/software/parallel/ installed you can do this to get all files in a single emacs:

cat filelist | parallel -Xj1 emacs

Do this to get them one at a time:

cat filelist | parallel -j1 emacs

It also deals nicely with filenames like:

12" records.txt

(Which your solution using xargs does not)

Watch the intro video for GNU Parallel to learn more:
http://www.youtube.com/watch?v=OpaiGYxkSuQ

[User Picture]From: kvance
2010-09-06 01:28 am (UTC)

Re: More readable using GNU Parallel

(Link)

That looks really, really useful. Thanks!
[User Picture]From: kartos
2010-09-08 04:55 am (UTC)

(Link)

[User Picture]From: kvance
2010-09-08 05:40 am (UTC)

(Link)

Nope! Though I almost wish I had a few so I could run emacs on emacs.