Sponsored Content
Full Discussion: Shell-Script und Pipes
Top Forums UNIX for Dummies Questions & Answers Shell-Script und Pipes Post 302093632 by napolayan on Saturday 21st of October 2006 08:56:42 AM
Old 10-21-2006
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!!!!!!!!!
 

7 More Discussions You Might Find Interesting

1. Filesystems, Disks and Memory

PIPEs and Named PIPEs (FIFO) Buffer size

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

rediretion and pipes in DOS shell cmd interpreter

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

Wrapper script for image deployment - stdin/stdout - named pipes and the like

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

Backup eines Verzeichnis und der unterverzeichnisse erstellen

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

redirect an awk string output to a script input with pipes

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

Suchen und Ersetzen mit AWK

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

Read workstation list from file und run command

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
CPANPLUS::Shell::Default::Plugins::Remote(3pm)		 Perl Programmers Reference Guide	    CPANPLUS::Shell::Default::Plugins::Remote(3pm)

NAME
CPANPLUS::Shell::Default::Plugins::Remote - connect to a remote CPANPLUS SYNOPSIS
CPAN Terminal> /connect localhost 1337 --user=foo --pass=bar ... CPAN Terminal@localhost> /disconnect DESCRIPTION
This is a "CPANPLUS::Shell::Default" plugin that allows you to connect to a machine running an instance of "CPANPLUS::Daemon", allowing remote usage of the "CPANPLUS Shell". A sample session, updating all modules on a remote machine, might look like this: CPAN Terminal> /connect --user=my_user --pass=secret localhost 1337 Connection accepted Successfully connected to 'localhost' on port '11337' Note that no output will appear until a command has completed -- this may take a while CPAN Terminal@localhost> o; i * [....] CPAN Terminal@localhost> /disconnect CPAN Terminal> BUG REPORTS
Please report bugs or other issues to <bug-cpanplus@rt.cpan.org<gt>. AUTHOR
This module by Jos Boumans <kane@cpan.org>. COPYRIGHT
The CPAN++ interface (of which this module is a part of) is copyright (c) 2001 - 2007, Jos Boumans <kane@cpan.org>. All rights reserved. This library is free software; you may redistribute and/or modify it under the same terms as Perl itself. SEE ALSO
CPANPLUS::Shell::Default, CPANPLUS::Shell, cpanp perl v5.18.2 2014-01-06 CPANPLUS::Shell::Default::Plugins::Remote(3pm)
All times are GMT -4. The time now is 07:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy