Add Comment
|
Related Links
|
TrackBack
where.sh (GPL)where.sh is a command-line shell script utility that will help you load files with specific regular expression. It starts in the current directory and looks under all subdirectories. It uses the UNIX "find" utility but doesn't require you to remember all of the command-line arguments. In addition, it suppresses all of the error messages that "find" generates. Suppress of the error messages are very helpful on UNIX system where you don't have access to many of the subdirectories. where.sh is distributed as executable source code under the GNU General Public License. Please see the license agreement elsewhere on this site. Usagewhere.sh "file name expression" Examplewhere.sh "*.zip" Locates all files with the "zip" extension. where.sh "CRW_7???.RAW" Locates all raw images in the 7000 series. Chieh Cheng Today, I needed to find all UNIX hidden files (starts with a period) in a sub-directory tree. But every time I issued ls .*, I get back everything all files in the current directory and all files in the parent directory. That is because the mask matches the "." and ".." directory entries as well. Finally, I optimized down to ls .??*, which weeded out "." and "..", but ignores hidden files with one and two character names. Eventually, it occurred to me that this where.sh script can easily help me out. And sure enough, issuing where.sh ".*"on the command line got me exactly what I wanted in mere seconds. Only if I could have thought of it that fast. Chieh Cheng I've beefed up the where.sh script so that it does more error checking and remove the writing to a temporary file. In addition, it now accept multiple file masks, to search for, on the command-line. UsageUsage: where.sh "file mask 1" [ . . . "file mask N" ] You must surround file masks in double-quotes. Examplewhere.sh "*.zip" "CRW_7???.RAW" Locates all files with the "zip" extension and all raw images in the 7000 series. Chieh Cheng Recently, I have installed quite a few virtual machines on my notebook computer. The virtual machines all share common folders, which are mounted via symbolic links. "where.sh" breaks down, because it does not search into symbolic links. Therefore, I've modified "where.sh" so that it does. The new version is attached below. Chieh Cheng
Add Comment
|
Related Links
|
TrackBack
Did your message disappear? Read the Forums FAQ. Add CommentSpam Control | * indicates required field TrackBackTrackBack only accepted from WebSite-X Suite web sites. Do not submit TrackBacks from other sites. Send Ping | TrackBack URL | Spam Control No TrackBacks yet. TrackBack can be used to link this thread to your weblog, or link your weblog to this thread. In addition, TrackBack can be used as a form of remote commenting. Rather than posting the comment directly on this thread, you can posts it on your own weblog. Then have your weblog sends a TrackBack ping to the TrackBack URL, so that your post would show up here. Messages, files, and images copyright by respective owners. |
Products
|
Services
67 Users Online
|
Copyright © 1996 - 2024. All Rights Reserved. |