-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Stefan Seifert wrote: > Curtis Olson wrote: > >> Don't bother listening to Melchior, he's busy coming up with absurdly long >> strings of obscure unix commands that are just a huge waste of time to >> type. You can do the same check with this much simpler command and save 26 >> key strokes (if you start in the aircraft directory): >> >> find . -name \*.xml -exec grep -l vsi-3d {} \; > > Well, just for completeness and because Melchior doesn't like -exec: > find . -name \*.xml | xargs grep vsi-3d > does the job just as well and is even simpler to type ;) > grep -R would be even shorter, but does search all files including > textures and models. > At least with (recent?) GNU find you could also use:
find . -name \*.xml -exec grep -l vsi-3d '{}' + The difference against the version using ; is that the ";-version" will invoke grep once for each found file, while the "+-version" will invoke like with as many arguments in one go that is possible. For more details see find(1), section "ACTIONS" on systems with GNU userland. Another reason why to not use the xargs version is that filenames can contain spaces and/or newlines. If you want to use xargs then at least do: find . -name \*.xml -print0 | xargs -0 grep vsi-3d This will cause the delimiter to be a null char that is not valid in filenames. This works on systems with GNU userland, but not on, for example, FreeBSD. While newlines in filenames is not likely a problem for flightgear, it is in some situations. Consider this script to clean old files from /tmp: find /tmp -atime 5 | xargs rm -f Now consider a file named (\n to show where the newline is): "foo\n/etc/passwd". Yes that is a valid filename. With the above find command, that would remove /etc/passwd. However on systems with GNU userland it is possible to do: find /tmp -atime 5 -print0 | xargs -0 rm -f That command would not remove /etc/passwd. However, an ever better solution, at least with GNU find, may be: find /tmp -atime 5 -delete ;P Regards, Arvid Norlander -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.7 (GNU/Linux) iD8DBQFHj2DMWmK6ng/aMNkRCl8RAJ9iBbpjSaT5qZrxOvw6ugxV8IioKgCZAf06 nJ6Opxp6sUa3ZkP4GgRDUIM= =r4b4 -----END PGP SIGNATURE----- ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel