Sponsored Content
Full Discussion: Shell-Script und Pipes
Top Forums UNIX for Dummies Questions & Answers Shell-Script und Pipes Post 302093933 by orno on Tuesday 24th of October 2006 05:32:56 AM
Old 10-24-2006
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 Smilie
 

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
h5diff(1)						      General Commands Manual							 h5diff(1)

NAME
h5diff - Compares two HDF5 files and reports the differences. SYNOPSIS
h5diff file1 file2 [OPTIONS] [object1 [object2 ] ] DESCRIPTION
h5diff is a command line tool that compares two HDF5 files, file1 and file2, and reports the differences between them. Optionally, h5diff will compare two objects within these files. If only one object, object1, is specified, h5diff will compare object1 in file1 with object1 in file2. In two objects, object1 and object2, are specified, h5diff will compare object1 in file1 with object2 in file2. These objects must be HDF5 datasets. object1 and object2 must be expressed as absolute paths from the respective file's root group. Additional information, with several sample cases, can be found in the document H5diff Examples. OPTIONS
file1 file2 The HDF5 files to be compared. -h Print all differences. -r Print only the names of objects that differ; do not print the differences. These objects may be HDF5 datasets, groups, or named datatypes. -n count Print difference up to count differences, then stop. count must be a positive integer. -d delta Print only differences that are greater than the limit delta. delta must be a positive number. The comparison criterion is whether the absolute value of the difference of two corresponding values is greater than delta (e.g., |a-b| > delta, where a is a value in file1 and b is a value in file2). -p relative Print only differences that are greater than a relative error. relative must be a positive number. The comparison criterion is whether the absolute value of the difference 1 and the ratio of two corresponding values is greater than relative (e.g., |1-(b/a)| > relative where a is a value in file1 and b is a value in file2). object1 object2 Specific object(s) within the files to be compared. EXAMPLES
The following h5diff call compares the object /a/b in file1 with the object /a/c in file2: h5diff file1 file2 /a/b /a/c This h5diff call compares the object /a/b in file1 with the same object in file2: h5diff file1 file2 /a/b And this h5diff call compares all objects in both files: h5diff file1 file2 SEE ALSO
h5dump(1), h5ls(1), h5repart(1), h5import(1), gif2h5(1), h52gif(1), h5perf(1) h5diff(1)
All times are GMT -4. The time now is 10:21 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy