Wednesday, June 12, 2013

[LINUX_Newbies] Re: Grep questions

 

On 12Jun2013 07:48, highskywhy@yahoo.de <highskywhy@yahoo.de> wrote:
| Is this right:
|
| grep -r "thisismyAIM" * > resu.txt
|
| Searching the whole hd
| and the file resu.txt show all file names
| contains thisismyAIM
| ?

That searches everything (except "dot" files) in the _current_
directory downward. If you first cd to "/", the current directory
would be the top of the tree and thus the search would be of all
files. (At least, all files to which you have access.)

A better command for your example might be:

grep -r "thisismyAIM" . > resu.txt

which searchs the current directory downward, or:

grep -r "thisismyAIM" / > resu.txt

which searches the top directory downward, regardless of your current
directory.

| grep -r -i "thisismyAIM" * > resu.txt
|
| Searching the whole hd
| and the file resu.txt show all file names
| contains thisismyAIM also thisismyaim and THISismyaim
| ?

The -i option performs a case insensitive search, so yes.
Subject to all the above limitations. You're not searching "the
whole hd", you are searching the current directory.

| grep -r "17hbss.htm" *.txt > resu.txt
|
| Searching the whole hd BUT only TXT files with the extension txt

No, only .txt files in the current directory.

| and the file resu.txt show all file names
| contains thisismyAIM
| ?

The output goes to the file "resu.txt". Whether it shows all the
filenames you seek depends on the correctness of the grep command.
As stated above, they commands you're showing do not do quite what
you think.

| Is there also a workshop
| for learning to use p7zip?

The p7zip command is called "7z". So the command "man 7z" shows you
the manual entry for that command. That should tell you how to use
it.

Cheers,
--
Cameron Simpson <cs@zip.com.au>

A squealing tire is a happy tire.
- Bruce MacInnes, Skip Barber Driving School instructor

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (12)
Recent Activity:
To unsubscribe from this list, please email LINUX_Newbies-unsubscribe@yahoogroups.com & you will be removed.
.

__,_._,___

No comments:

Post a Comment