Thursday, June 20, 2013

[LINUX_Newbies] Re: Grep questions

 


Do Jun 20 14:23:47 2013
Good afternoon
Thank You for help.

| 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.

*
OK

I start terminal:

name@nameM57p:~$

Is this the root?
Does grep now search the whole hd?

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.)
*
I do
cd /

name@nameM57p:~$ cd /
name@nameM57p:~$

Is this root?

A better command for your example might be:

grep -r "thisismyAIM" . > resu.txt

*
grep -r "thisismyAIM" . > resu.txt
Is this better then
grep -r "thisismyAIM" * > resu.txt

which searchs the current directory downward, or:

grep -r "thisismyAIM" / > resu.txt

Is
grep -r "thisismyAIM" / > resu.txt
the smae like
grep -r "thisismyAIM" * / > resu.txt

?

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

| 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.
*
OK
Question:

Is
grep -r -i "thisismyAIM" * > resu.txt
and
grep -i -r "thisismyAIM" * > resu.txt
the same?

| 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.
*
OK

| 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.
*
OK

As stated above, they commands you're showing do not do quite what
you think.
*
OK
Thank You.

| 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,

Regards
Sophie

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

__,_._,___

No comments:

Post a Comment