A Windows XP help forum. PCbanter

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.

Go Back   Home » PCbanter forum » Microsoft Windows XP » General XP issues or comments
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Filtering output from a command



 
 
Thread Tools Display Modes
  #1  
Old February 3rd 11, 02:37 AM posted to microsoft.public.windowsxp.general
RichardOnRails
external usenet poster
 
Posts: 104
Default 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  
Old February 3rd 11, 03:51 AM posted to microsoft.public.windowsxp.general
Tester[_2_]
external usenet poster
 
Posts: 341
Default 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  
Old February 3rd 11, 11:04 AM posted to microsoft.public.windowsxp.general
Bob Willard
external usenet poster
 
Posts: 273
Default 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  
Old February 3rd 11, 05:04 PM posted to microsoft.public.windowsxp.general
RichardOnRails
external usenet poster
 
Posts: 104
Default 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  
Old February 3rd 11, 05:17 PM posted to microsoft.public.windowsxp.general
RichardOnRails
external usenet poster
 
Posts: 104
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off






All times are GMT +1. The time now is 03:01 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 PCbanter.
The comments are property of their posters.