Quote:
Originally Posted by anja_22
Hi, beginne gerade mich in der UNIX Welt zu recht zu finden : habe nun folgendes Anliegen, hoffe ihr könnt mir helfen (ist sicher trival für euch, sorry dafür -) )
Ich möchte mir ein kleines Shell-Script schreiben , welches mir dateien eines bestimmten verzeichnisses anhand der Anzahl der enthaltenen Wörter vergeleicht und anschließend die Dateien sortiert ausgibt.
Ich weiß der befehl wc -w zählt die Wörter einer Datei und der Befehl sort sortiert
Problem : Ich muss ja nun erstmal die dateien anhand der Anzahl der Wörter vergelichen, sprich die Wörter zählen : wc -w datei1 datei1 : zählt die Wörter in datei1 und ind datei2 und gibt ergebnis aus ; soweit so gut : ich wollte nun für mein verzeichnis folgendes probieren : find <verzeichnis> -name *.txt | wc -w ; bekomme als Ergebnis aber leider nur die Anzahl der dateien raus und nicht die Anzahl der Wörter in dieser : es werden 3 Dateien gefunden und gelistet und diese drei Dateien wollte ich nun an die Standardeingabe von wc reichen, damit wc entsprechend arbeitet ( wie wc -w dateie1 datei2) das tut die shell offensichtlich nicht : wc zählt die Anzahl der dateien ????????
Wiegesagt bin neu , bin für jeden Tipp dankbar,
lieben Gruß
Anja
Hi Anja
Ich versuchte, zu übersetzen, was u mit google schrieb, aber noch, das es bilden doesnt Menge von der Richtung... du sie auf englisch versuchen und bekanntgeben kann? Die übersetzung ist unten zugunsten jedermann, das englisch spricht und es heraus darstellen kann.
(For english speakers,the above is the translation of what is below in english, for anja's sake)
I tried translating what u wrote with google, but still it doesnt make a lot of sense... can you try and post it in english? The translation is below for the benefit of anyone who knows english and can figure it out.
Rear one, begins to find straight me in the UNIX world rightfully: now if the following request has, hope you can me help (is safe trival for you, sorry for it -)) I would like to be written a small shell Script, which me files of a certain listing on the basis the number of contained words gel-calibrated and afterwards sorted spends the files. I know the instruction wc - w counts the words of a file and the instruction sort sorted Problem: I must now first times the files on the basis the number of words vergelichen, speak the words to count: wc - w datei1 datei1: and ind datei2 counts the words in datei1 and spends result; so far so well: I wanted to try now for my listing the following: find <verzeichnis> - name *.txt | wc - w; get as result however unfortunately only the number of files raus and not the number of words in this: 3 files are found and listed and these three files wanted to be enough I now to the standard input of wc, so that wc works accordingly (like wc - w dateie1 datei2) does the shell obviously not: wc the number of files counts???????? Cradle-said are new, are for everyone tap gratefully, love greeting Anja
Arggggggggghhhhhhhhh!!!!!!!!!