Tuesday, June 25, 2013

Re: [LINUX_Newbies] Re: Grep questions

 

Di Jun 25 09:33:00 2013
Good morning
Thank You for help.

On 20Jun2013 14:30, highskywhy@yahoo.de <highskywhy@yahoo.de> wrote:
| I start terminal:
|
| name@nameM57p:~$
|
| Is this the root?

No. It is your home directory, probably something like /home/name.
The command "pwd" will tell you ("print working directory").
*
What is the difference between root and home?
Is root where the program files are?
Ist home where the data files are?

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

Yes.
*
OK.

| 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

Slightly. "*" will not match files/directories starting with a dot ("."),
like .ssh. That is a convention to "hide" configuration files as a
matter of convenience.
It may be what you want, or it may not.

*
So if I am searching for my data files like
text.txt
pic.gif
movie.avi

then it is the same and I can use both like:
grep -r "thisismyAIM" . > resu.txt
grep -r "thisismyAIM" * > resu.txt
?

Searching * will missing the "dot" names.
Searching "." will read everything, starting at the current directory
(which is called ".").
*
OK.

| 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

Same issue as above, yes. "dot" names versus all names.
*
OK

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

Yes.
*
So I can change
the options in the commands.

For commands where options just turn "modes" on an off (-i,
-r) the order generally does not matter.
*
OK
Thank You.
For a beginner like me this is a very important inforamtion.
Thank You.

For some commands the order
can matter: where different options overlap in the features they
control, or some rather dodgy commands where options and arguments
can be mixed on the line.
*
OK.

When in doubt, consult the manual page for the command (eg "man grep").
*
OK.

Regards
Sophie

Thank You.

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

__,_._,___

No comments:

Post a Comment