10-21-2006
Shell-Script und Pipes
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
7 More Discussions You Might Find Interesting
1. Filesystems, Disks and Memory
Hello!
How I can increase or decrease predefined pipe buffer size?
System FreeBSD 4.9 and RedHat Linux 9.0
Thanks! (1 Reply)
Discussion started by: Jus
1 Replies
2. Windows & DOS: Issues & Discussions
Hello,
I am trying to accomplish the following.
Send the output of a command to the screen (this happens by default) as well as capture the output of the screen to a log file.
How can this be achieved in DOS command interpreter syntax.
Any ideas/suggesstions/indicators are greatly... (2 Replies)
Discussion started by: jerardfjay
2 Replies
3. Shell Programming and Scripting
Hi everyone, first post here.
Anyone who isn't interested in the background, press pagedown :).
I sometimes need to make scripts for little things I need in the infrastructure at the company I work at. Currently I am trying to make a wrapper script for a proprietary image-deployment program.... (2 Replies)
Discussion started by: andreas.ericson
2 Replies
4. Shell Programming and Scripting
Hallo
ich bin neu in dem bereich Bash scripting
und deswegen suche ich ein script der auf meinem unix server laufen soll
und zwar immer wenn ich den server starte
oder alle 24h
der script soll ein backup von einem verzeichnis und meheren unterverzeichnissen erstellen
da ich nirgends was... (1 Reply)
Discussion started by: HansWurst
1 Replies
5. Shell Programming and Scripting
Hi,
I have a function in a bash script that returns a string after some operations using awk.
The following code returns 555
$VARIABLE="EXAMPLE"
get_number $VARIABLE
this value I'd like to pass it as a second argument of another script with the following usage
myscript.sh <param1>... (7 Replies)
Discussion started by: rid
7 Replies
6. Shell Programming and Scripting
Hallo,
ich habe mir mit meinen dürftigen Programmierkenntnissen ein Script zusammengebastelt über das ich in einem bestimmten Odner mit AWK alle Dateien eines Verzeichnis durchsuche und bestimmte Bezeichungen aller Dateien ändern kann.
Es funktioniert auch soweit, nur hätte ich gerne auch die... (1 Reply)
Discussion started by: ruffi
1 Replies
7. UNIX for Dummies Questions & Answers
Hi,
how do I read in a file which includes a list of workstations and then run a command for each workstation ?
I am unclear which command to use to read in , or is this not possible ?
Thanks, (3 Replies)
Discussion started by: manni2
3 Replies