The UNIX and Linux Forums  

Go Back   Die UNIX-und Linux-Foren > Top Foren > UNIX for Dummies Questions & Answers
.
Google unix.com



UNIX for Dummies Questions & Answers Wenn Sie nicht sicher sind, wo Sie eine UNIX-oder Linux-Frage, post it here. Alle UNIX-und Linux-Anfänger willkommen!

Mehr UNIX-und Linux-Forum Themen Vielleicht finden Sie hilfreiche
Faden Thread Starter Forum Antworten Last Post
hilft mir bei der Übermittlung von Parametern sqlplus Skript Unix-Shell-Skript Hara Shell Programmierung und Scripting 2 01-29-2008 03:31 PM
Shell-Skript: einfügen wollen Werte in der Datenbank, wenn Update-Skript läuft Ring Shell Programmierung und Scripting 1 10-25-2007 04:06 AM
hier Dokument zu automatisieren, Perl-Skript, dass Call-Skript hogger84 Shell Programmierung und Scripting 3 10-22-2007 11:15 AM
Rückkehr an die Muttergesellschaft nach Shell-Aufruf ein Skript in ein Skript gurukottur Shell Programmierung und Scripting 5 09-26-2006 08:05 AM
Rückkehr aus valuse Kind Skript zur Muttergesellschaft Skript borncrazy Shell Programmierung und Scripting 1 08-20-2004 04:39 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Suche diesen Thread Rate Thread Anzeige-Modi
  #1 (permalink)  
Old 11-01-2006
wereyou wereyou is offline
Registrierte Nutzer
  
 

Join Date: Sep 2006
Beiträge: 19
Script-Hilfe

Ich bin mit diesem Skript und führt es über eine Anzahl von 6 weniger als das, was ist manuell summiert. Wie kann ich das Skript -6 oder eine genaue Anzahl von dem, was die Zahl ist, wenn manuell hinzugefügt werden?

$ CONMAN SJ HCSCPROD#@.> $ MYHOME / hcscprod_job_totals
$ CONMAN SJ HCNCPROD#@.> $ MYHOME / hcncprod_job_totals
$ CONMAN SJ KTAZP#@.> $ MYHOME / ktazp_job_totals
$ CONMAN SJ KTAZD#@.> $ MYHOME / ktazd_job_totals
$ CONMAN SJ KTAZI#@.> $ MYHOME / ktazi_job_totals
$ CONMAN SJ KTAZQ#@.> $ MYHOME / ktazq_job_totals
cat $ MYHOME / hcscprod_job_totals | wc-l> no_file
cat $ MYHOME / hcncprod_job_totals | wc-l>> no_file
cat $ MYHOME / ktazp_job_totals | wc-l>> no_file
cat $ MYHOME / ktazd_job_totals | wc-l>> no_file
cat $ MYHOME / ktazi_job_totals | wc-l>> no_file
cat $ MYHOME / ktazq_job_totals | wc-l>> no_file
print "hcscprod_job_totals">> $ MYHOME / hcscprod_job_totals | mehr MYHOME $ / hcscp
rod_job_totals | wc-l "hcscprod_job_totals"
print "hcncprod_job_totals">> $ MYHOME / hcncprod_job_totals | mehr MYHOME $ / hcncp
rod_job_totals | wc-l "hcncprod_job_totals"
print "ktazp_job_totals">> $ MYHOME / ktazp_job_totals | mehr MYHOME $ / ktazp_job_tot
als | wc-l "ktazp_job_totals"
print "ktazd_job_totals">> $ MYHOME / ktazd_job_totals | mehr MYHOME $ / ktazd_job_to
Krankenhäuser | wc-l "ktazd_job_totals"
print "ktazi_job_totals">> $ MYHOME / ktazi_job_totals | mehr MYHOME $ / ktazi_job_to
Krankenhäuser | wc-l "ktazi_job_totals"
print "ktazq_job_totals">> $ MYHOME / ktazq_job_totals | mehr MYHOME $ / ktazq_job_to
Krankenhäuser | wc-l "ktazq_job_totals"
awk '(for (i \u003d 1; i <\u003d NF; i + +) s \u003d s + $ i); END (print s) "no_file



3240 hcscprod_job_totals
1781 hcncprod_job_totals
5421 ktazp_job_totals
4792 ktazd_job_totals
1367 ktazi_job_totals
28 ktazq_job_totals
16623
  #2 (permalink)  
Old 11-01-2006
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix-Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9124
Sie sind das Zählen der Zeilen in einer Datei. Dann fügen Sie eine Zeile. Dann zeigt die neue zählen. Dann summieren sich die alte zählt.

Code:
$ echo "one
> two
> three" > file
$ cat file
one
two
three
$ cat file | wc -l
       3
$ print "extra total line that the above wc missed somehow"  >> file  | more file | wc -l
       4
Zählen Sie die Zeilen in einer Datei zweimal langsam wird Sie am besten. Es ist wirklich schade, dass Sie erzählen nach dem Hinzufügen einer Zeile. Und Blick auf die Pipeline. Es macht keinen Sinn. Die print-Anweisung wird auf eine Datei, damit es hat nichts damit zu füttern in "mehr". Und "mehr" öffnet eine Datei in diesem Fall ignorieren und trotzdem stdin.

Vielmehr als "cat file | wc-l", verwenden Sie einfach:
wc-l <Datei
Durch die Umleitung der Eingabe, die Shell öffnet die Datei nicht als wc Öffnen der Datei. So wc wird nicht der Dateiname. Versuchen Sie einmal, dies zu tun und mit der gleichen Anzahl an beiden Stellen.
Closed Thread

Lesezeichen

Thread Tools Suche diesen Thread
Suche diesen Thread:

Erweiterte Suche
Anzeige-Modi Rate this thread
Rate this thread:

Forumregeln
Du möglicherweise nicht neue Themen
Du möglicherweise nicht nach Antworten
Du möglicherweise nicht post-Anlagen
Du möglicherweise nicht bearbeiten Sie Ihre Beiträge

BB-Code ist Auf
Smilies sind Auf
[IMG] Code Auf
HTML-Code ist Aus
Trackbacks sind Auf
Pingbacks sind Auf
Refbacks sind Auf




Alle Zeiten sind GMT -4. Es ist jetzt 09:19 PM.


Powered by: vBulletin, Copyright © 2000 - 2006, Jelsoft Enterprises Ltd. Sprachliche Übersetzungen Powered by .
vBCredits v1.4 Copyright © 2007 - 2008, PixelFX Studios
Die UNIX-und Linux-Foren Content © Copyright 1993-2009. Alle Rechte Reserved.Ad Management von RedTyger

Content Relevant URLs durch vBSEO 3.2.0