-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [re-adding the list, so that the archives see the resolution of this thread]
According to Emmanuel Dumont on 3/16/2009 10:18 AM: > Hi Eric > > Thanks for feed back. > >> A bit of overkill. When stdout of ls is not a terminal, then the -1 >> option is redundant. And globbing * can run into command line length >> limitations, which are avoided if you use a listing of . (or the implicit >> default of ls). In other words, this is equivalent: >> >> ls | nl --first-page=2 >> >> > You're right, I did add -1 option because my ls was aliased to ls -C > for the globbing, I was actually specifying a filename like filename.*.* > (like an image sequence) > But I realise that the command line length limitation can come into play > in that case too. might consider using xargs maybe > (how many files in the sequence would be too much?) echo filename.*.* | xargs nl --starting-line-number=2 will proceed to chunk your listing into the fewest number of necessary processes, although you will then have to deal with the fact that each instance of nl starts its numbering over again. And by using echo (a shell builtin) instead of ls (an external process), you are using one less process. But that does not deal with newlines in the glob, so you may want to use GNU findutils, and: find -maxdepth 1 -name 'filename.*.*' -print0 \ | xargs -0 nl --starting-line-number=2 - -- Don't work too hard, make some time for fun as well! Eric Blake e...@byu.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkm+fuYACgkQ84KuGfSFAYAE1ACgueFskresj7tn0V2kwJf4mQtI RX8AoIHWYYe9XlSo2ALCR5fE6gJT7vjz =KXwD -----END PGP SIGNATURE----- _______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils