Hey there!
I'm actually working myself through a tutorial on
http://linuxzoo.net/ wich is quite nice for learning some basic linux commands.
I'm a little stuck in tutorial 5 where it says:
Quote:
Question 11: find root files
Find all the files in /var (including subdirectories) that are owned by user root. Send the list of full path names to s8.
Your find command may produce "Permission Denied" errors during this search. This will have no effect on the answer, and this error can be safely ignored for this question.
|
This is a pipelining exercise so I did this:
Code:
find /var/ -user root | grep -E '(\/(.*?\/)+)' >s8
I use grep -E with a regular expression that should only extract the path from found files and write it in a file called s8.
What confuses me here is that when I check my regular expression on a testing website like
http://regexpal.com/ it clearly shows that the last slash is part of the match. But when I execute the above line, the file s8 contains all the paths without the last slash.
What is even more confusing is the next task in the row:
Question 12: find .conf files
Quote:
Find all the files in /etc (including subdirectories) end .conf Send the list of full path names to s9.
Your find command may produce "Permission Denied" errors during this search. This will have no effect on the answer, and this error can be safely ignored for this question.
|
So here I did this:
Code:
find /etc/ -type f -name "*.conf" | grep -E '(\/(.*?\/)+)' >s9
Which conludes in a file s9 where not only the path is visible but also all the names of the .conf files.
How is this even possible? I'm using the same regular expression!
I'm clueless. Any help appreciated. Best regards, MisterIX.