Hi,
ich versuche geraden die Aufgaben von tldp zu lösen. Hab da so meine Probleme zumal es ja keine Lösungen gibt.
1) Display a list of all the users on your system who log in with the Bash shell as a default.
2) From the /etc/group directory, display all lines starting with the string "daemon".
3) Print all the lines from the same file that don't contain the string.
Dazu müsste man die character sequence "daemon" doch irgendie groupen und dann die group dann negieren oder so. Aber das krieg ich nicht auf die Reihe. Problem ist wohl auch in meiner Version, dass ^ sowohl für Negation als auch für den Zeilenanfang stehen kann.
4) Display localhost information from the /etc/hosts file, display the line number(s) matching the search string and count the number of occurrences of the string.
Teil 1 geht noch:
Aber wie soll das mit der Anzahl mit der das Wort "localhost" funktionieren?
5) Display a list of /usr/share/doc subdirectories containing information about shells.
Hier weiss ich nicht ganz wie das gemeint ist. Ich kann natürlich mit egrep -r rekursiv duch /usr/share/doc durchlaufen und krieg dann jedes file, das das Wort "shell" enhält.
6) How many README files do these subdirectories contain? Don't count anything in the form of "README.a_string".
Seh ich das richtig, dass hier mit find gearbeitet werden soll?
Hier scheitere ich aber wieder an der negierung von ".a_string". Einen . kann ich ich mit \. escapen, sodass der . gemeint ist und nicht "any character" oder?
7) Make a list of files in your home directory that were changed less that 10 hours ago, using grep, but leave out directories.
Ist mir schleierhaft, wie das mit grep gehen soll ohne find -ctime zu benutzen.
Erstmal soweit. Wäre nett wenn mir da jemand helfen könnte!
ciao
serow
ich versuche geraden die Aufgaben von tldp zu lösen. Hab da so meine Probleme zumal es ja keine Lösungen gibt.
1) Display a list of all the users on your system who log in with the Bash shell as a default.
Code:
egrep :/bin/bash$ /etc/passwd
2) From the /etc/group directory, display all lines starting with the string "daemon".
Code:
egrep ^daemon /etc/group
3) Print all the lines from the same file that don't contain the string.
Dazu müsste man die character sequence "daemon" doch irgendie groupen und dann die group dann negieren oder so. Aber das krieg ich nicht auf die Reihe. Problem ist wohl auch in meiner Version, dass ^ sowohl für Negation als auch für den Zeilenanfang stehen kann.
4) Display localhost information from the /etc/hosts file, display the line number(s) matching the search string and count the number of occurrences of the string.
Teil 1 geht noch:
Code:
grep -n localhost /etc/hosts
5) Display a list of /usr/share/doc subdirectories containing information about shells.
Hier weiss ich nicht ganz wie das gemeint ist. Ich kann natürlich mit egrep -r rekursiv duch /usr/share/doc durchlaufen und krieg dann jedes file, das das Wort "shell" enhält.
6) How many README files do these subdirectories contain? Don't count anything in the form of "README.a_string".
Seh ich das richtig, dass hier mit find gearbeitet werden soll?
Code:
find /usr/share/doc -regex .*README
7) Make a list of files in your home directory that were changed less that 10 hours ago, using grep, but leave out directories.
Ist mir schleierhaft, wie das mit grep gehen soll ohne find -ctime zu benutzen.
Erstmal soweit. Wäre nett wenn mir da jemand helfen könnte!
ciao
serow