If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Filtering output from a command
Hi,
I'd like to do something like: dir *.rb | find ".rb" in order to filter out everything returned by Dir except lines that presumably contain the file-names. "find" appears not to be a legitimate, but I recall doing something like this in DOS and/or early versions of Windows like 3.1. I Googled for this and checked MS' docs for XP's command line to no avail (There may be an option like that for Dir, but I'm interested in the filtering process itself, not that particular command.) Any ideas? Thanks in advance, Richard |
Ads |
#2
|
|||
|
|||
Filtering output from a command
Try this: dir *.rb /b The above command will return all files with .rb as extension and nothing else. hth RichardOnRails wrote: Hi, I'd like to do something like: dir *.rb | find ".rb" in order to filter out everything returned by Dir except lines that presumably contain the file-names. "find" appears not to be a legitimate, but I recall doing something like this in DOS and/or early versions of Windows like 3.1. I Googled for this and checked MS' docs for XP's command line to no avail (There may be an option like that for Dir, but I'm interested in the filtering process itself, not that particular command.) Any ideas? Thanks in advance, Richard |
#3
|
|||
|
|||
Filtering output from a command
On 2/2/2011 9:37 PM, RichardOnRails wrote:
Hi, I'd like to do something like: dir *.rb | find ".rb" in order to filter out everything returned by Dir except lines that presumably contain the file-names. "find" appears not to be a legitimate, but I recall doing something like this in DOS and/or early versions of Windows like 3.1. I Googled for this and checked MS' docs for XP's command line to no avail (There may be an option like that for Dir, but I'm interested in the filtering process itself, not that particular command.) Any ideas? Thanks in advance, Richard Find is still there, at least in the 32bit versions of XP SP3 and Vista. Bring up cmd.exe and type HELP FIND to get the syntax. -- Cheers, Bob |
#4
|
|||
|
|||
Filtering output from a command
On Feb 3, 6:04*am, Bob Willard wrote:
On 2/2/2011 9:37 PM, RichardOnRails wrote: Hi, I'd like to do something like: dir *.rb | find ".rb" in order to filter out everything returned by Dir except lines that presumably contain the file-names. "find" appears not to be a legitimate, *but I recall doing something like this in DOS and/or early versions of Windows like 3.1. *I Googled for this and checked MS' docs for XP's command line to no avail (There may be an option like that for Dir, *but I'm interested in the filtering process itself, not that particular command.) Any ideas? Thanks in advance, Richard Find is still there, at least in the 32bit versions of XP SP3 and Vista. *Bring up cmd.exe and type HELP FIND to get the syntax. -- Cheers, Bob Hi Bob, Thanks for your response. I'm running WinXP-Pro/SP3 (32-bit). Here's what I got in my Command Window: ========================= K:\help find find: /?: No such file or directory K:\help [snip] FIND Searches for a text string in a file or files. FINDSTR Searches for strings in files. [snip] K:\help FIND FIND: /?: No such file or directory K:\ ========================= How in the world could I have destroyed the Find command on my system? Or better yet, how can I repair my Command sub-system. I've still got my original WinXP upgrade to Win2K, but with three Service Packs laid on top of XP, that original disk is useless IMHO. Any ideas? Best wishes, Richard |
#5
|
|||
|
|||
Filtering output from a command
On Feb 2, 10:51*pm, Tester wrote:
Try this: dir *.rb /b The above command will return all files with .rb as extension and nothing else. hth RichardOnRails wrote: Hi, I'd like to do something like: dir *.rb | find ".rb" in order to filter out everything returned by Dir except lines that presumably contain the file-names. "find" appears not to be a legitimate, *but I recall doing something like this in DOS and/or early versions of Windows like 3.1. *I Googled for this and checked MS' docs for XP's command line to no avail (There may be an option like that for Dir, *but I'm interested in the filtering process itself, not that particular command.) Any ideas? Thanks in advance, Richard Hi Tester, I was confident that Dir had switches for things like "Just give me the facts Ma'am without all the fluff". Sure 'nuf, Help Dir revealed the /B switch for "Bare Format". But your example did show me one new thing: One need not leave white-space between the basic command and a switch. So, your example was perfect. But I still want to get "command-chaining" to work for a batch program I'm writing. Bob Willard led me to discover that my "Find" command is somehow broken on my WinXP-Pro/SP3 system, and I'd like to get a solution to that issue. Best wishes, Richard |
Thread Tools | |
Display Modes | |
|
|