bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Excluding files with grep


From: DarkRick
Subject: Re: Excluding files with grep
Date: Tue, 7 Nov 2006 10:37:14 -0800 (PST)

Hello,

First, thanks for the answers, these were really useful. Second, I think
that it doesn't work in a windows system with Unix Utils because the Unix
Utils are limited, and doesn't have some parameters, then, when I try to use
the sentence "grep -rHc '[[:print:]]' mydirecotry | grep ':0$'" it shows no
answer.

So, and i try to call "grep -rHc '[[:print:]]' mydirecotry" and it shows
this answer:
Error: Invalid option -H

And when I use "grep ':0$' ." it shows this answer:
File .\filename.ext:
Error: Line too long (file may be binary) - search aborted

So, and when I display the Unix Utils Grep Help. it shows:
Turbo GREP  Version 1.2  Copyright (c) 1987, 1989 Borland International
Syntax:  GREP [-rlcnvidzuwo] searchstring file[s]

Options are one or more option characters preceeded by "-", and optionally
followed by "+" (turn option on), or "-" (turn it off).  The default is "+".
   -r+  Regular expression search       -l-  File names only
   -c-  match Count only                -n-  Line numbers
   -v-  Non-matching lines only         -i-  Ignore case
   -d-  Search subdirectories           -z-  Verbose
   -u-  Update default options          -w-  Word search
   -o-  UNIX output format                   Default set: [0-9A-Z_]

A regular expression is one or more occurrences of:  One or more characters
optionally enclosed in quotes.  The following symbols are treated specially:
   ^  start of line             $  end of line
   .  any character             \  quote next character
   *  match zero or more        +  match one or more

   [aeiou0-9]   match a, e, i, o, u, and 0 thru 9
   [^aeiou0-9]  match anything but a, e, i, o, u, and 0 thru 9

Thank you a lot again...

DarkRick


Tony Abou-Assaleh-2 wrote:
> 
> You need to provide more details about what happens, and why you think it
> doesn't work, and if there are any errors or other messages. E.g.,
> provide sample input and output.
> 
> BTW, why do you add number to name when addressing people?
> 
> Cheers,
> 
> TAA
> 
> -----------------------------------------------------
> Tony Abou-Assaleh
> Email:    address@hidden
> Web site: http://tony.abou-assaleh.net
> ----------------------[THE END]----------------------
> 
> On Thu, 2 Nov 2006, DarkRick wrote:
> 
>>
>> Hi Tony Abou-Assaleh-2,
>>
>> I must suppose that the all the undamaged files have some printable
>> characters. I tried your solution and it works really good when I'm in a
>> Linux system. Thanks a lot.
>>
>> But when I'm working with Unix Utils for a windows system it doesn't
>> work.
>> What can I do? Or how should I fix it?
>>
>> Thanks again.
>>
>>
>> Tony Abou-Assaleh-2 wrote:
>> >
>> > Are the undamaged files text files that are guaranteed to have some
>> > printable characters anywhere in the file?
>> >
>> > If so, then the following worked on my testing:
>> >
>> > grep -rHc '[[:print:]]' mydirecotry | grep ':0$'
>> >
>> > Cheers,
>> >
>> > TAA
>> >
>> > -----------------------------------------------------
>> > Tony Abou-Assaleh
>> > Email:    address@hidden
>> > Web site: http://tony.abou-assaleh.net
>> > ----------------------[THE END]----------------------
>> >
>> > On Wed, 1 Nov 2006, DarkRick wrote:
>> >
>> >>
>> >> Hi Jian Wang-4,
>> >>
>> >> I have a lot of files in different folders, and some of them are
>> damaged.
>> >> A
>> >> damaged file looks like a normal file in size,  i.e 300 Kb, but all
>> the
>> >> 300
>> >> Kb of the file is 00 in hexadecimal format.
>> >> I don't know exactly which files are damaged, so and I found this
>> >> needing:
>> >> 1. To list the files that are ok and exclude all damaged files (That
>> are
>> >> not
>> >> full of 00 in hexadecimal format), but that it is not useful because I
>> >> need
>> >> to replace the damaged files, or
>> >> 2. To list the files full of 00 in hexadecimal format
>> >>
>> >> I tried the second choice with this sentence:
>> >> $ find / -type f -print | grep ^[1-9A-Za-z]
>> >> It would return the files that doesn't contain the character set that
>> I
>> >> want
>> >> to remove, but it returns nothing.
>> >>
>> >> Thanks a lot.
>> >
>> >
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Excluding-files-with-grep-tf2546079.html#a7134945
>> Sent from the Gnu - Grep mailing list archive at Nabble.com.
>>
>>
>>
> 
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Excluding-files-with-grep-tf2546079.html#a7224283
Sent from the Gnu - Grep mailing list archive at Nabble.com.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]