The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #4 (permalink)  
Old 10-24-2006
orno orno is offline
Registered User
  
 

Join Date: Oct 2006
Posts: 21
Since I'm feeling nice, here's a translation:

Quote:
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 -) )
Hi, I'm just starting to find my way around the UNIX world and now have the following problem, I hope you guys can help (its most probably trivial for you and I'm sorry for that)

Quote:
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.
I want to write a small Shell-Script which compares my files in a particular folder and then sorts it out according to the number of words contained.

Quote:
Ich weiß der befehl wc -w zählt die Wörter einer Datei und der Befehl sort sortiert
I know the command 'wc -w' counts the number of words in a file and the command 'sort', sorts the files

Quote:
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 ????????
My Problem: I have to first compare the files for number of words: e.g. 'wc -w file1 file2' compares the number of words in file1 and file2 and gives me the result. so far so good. Then i want to try the following for my folder: 'find <folder> -name *.txt| wc -w'

This unfortunately gives me the number of files, not the number of words in these files. So, if 3 files are found and listed, I want to now pass these 3 as input to wc so that wc can do its magic on them (e.g. wc -w file1 file2). For some reason the shell doesn't do this and wc counts the number of files????

Quote:
Wiegesagt bin neu , bin für jeden Tipp dankbar
Like I said, I'm new and am thankful for every tip

Phew