The UNIX and Linux Forums  


Go Back   Die UNIX-und Linux-Foren > Top Foren > Shell Programmierung und Scripting
.
Google unix.com



Shell Programmierung und Scripting Post Fragen zu ksh, csh, sh, bash, Perl, PHP, sed, awk und anderen Shell-Skripte und Shell-Scripting-Sprachen hier.

Mehr UNIX-und Linux-Forum Themen Vielleicht finden Sie hilfreiche
Faden Thread Starter Forum Antworten Last Post
Suche ")" mit egrep - egrep: Syntax-Fehler sagarjani UNIX for Dummies Questions & Answers 7 10-14-2008 08:30 AM
egrep / grep Ergebnis von mehr Dateien tvrman Shell Programmierung und Scripting 3 08-07-2008 09:29 AM
Egrep Spickzettel überall? Suchen Sie nach dem Sinn von egrep-c leelm UNIX for Dummies Questions & Answers 2 01-11-2008 03:37 PM
perl - Kopieren von Dateien BG_JrAdmin Shell Programmierung und Scripting 1 12-13-2007 09:50 PM
Perl-Upload von Dateien sstevens UNIX für Fortgeschrittene und Experten 16 02-24-2004 03:03 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-17-2008
thepurple thepurple is offline
Registrierte Nutzer
  
 

Join Date: Oct 2007
Beiträge: 134
Perl oder awk / egrep von großen Dateien?

Hi Experten.

In einem Thread habe ich Ihnen, wie Sie grep die Zeichenfolge aus dem unten Beispieldatei -

Leider ist das Skript nicht gab ordnungsgemäße Ausgang (es fehlen viele Strings). Es geschah kann ich kamen Sie auf die korrekte Inhalt der Datei

Das war der Skript -
"$ perl -00nle 'print join "\ n", / <fullOperation> (.*?):.*< fullResult >(.*?);/ s' filename.txt"

Jetzt für Sie Bequemlichkeit i fügen Inhalte hier von Anfang an die Datei -

Ausgabe der Datei wäre unter -

CREATE
RESP: -3010

DELETE
RESP: 0

CREATE
RESP: 911364896

GET
RESP: 0

SET
RESP: 911265678


<? xml version \u003d'1 .0 'encoding \u003d "ISO-8859-1" standalone \u003d "no">
<LogItems>
<log logid\u003d"83efeae5190811100759420954">
<category> Upstream.CAI </ Kategorie>
<operation> Login </ Operation>
<target> CAI </ target>
<Instanz> </ Beispiel>
<user> </ user>
<context> </ context>
<fullOperation> LOGIN: server1: eri4ema </ fullOperation>
<starttime> 20081110075942,366900 </ starttime>
<stoptime> 20081110075942,424451 </ stoptime>
<fullResult> RESP: 3001; </ fullResult>
<status> fehlgeschlagen </ status>
</ log>
<log logid\u003d"83efeae5190811100759480955">
<category> Upstream.CAI </ Kategorie>
<operation> Login </ Operation>
<target> CAI </ target>
<Instanz> </ Beispiel>
<user> </ user>
<context> </ context>
<fullOperation> LOGIN: server1: eri4ema; </ fullOperation>
<starttime> 20081110075948,375669 </ starttime>
<stoptime> 20081110075948,375923 </ stoptime>
<fullResult> RESP: 3007; </ fullResult>
<status> fehlgeschlagen </ status>
</ log>
<log logid\u003d"83efeae5190811100759580956">
<category> Upstream.CAI </ Kategorie>
<operation> Login </ Operation>
<target> CAI </ target>
<Instanz> </ Beispiel>
<user> server1 </ user>
<context> SOG </ context>
<fullOperation> LOGIN: server1 :*******;</ fullOperation>
<starttime> 20081110075958,354986 </ starttime>
<stoptime> 20081110075958,355238 </ stoptime>
<fullResult> RESP: 0; </ fullResult>
<status> ERFOLGREICHEN </ status>
</ log>
</ LogItems>

<? xml version \u003d'1 .0 'encoding \u003d "ISO-8859-1" standalone \u003d "no">
<LogItems>
<log logid\u003d"83efeae5190811100802020957">
<category> Upstream.CAI </ Kategorie>
<operation> Get </ Operation>
<target> ESUB </ target>
<Instanz> CODE \u003d 432350114484630 </ Beispiel>
<user> server1 </ user>
<context> SOG </ context>
<fullOperation> GET: ESUB: CODE, 432350114484630; </ fullOperation>
<starttime> 20081110080202,185236 </ starttime>
<stoptime> 20081110080202,834500 </ stoptime>
<fullResult> RESP: 11000003; UNKNOWN SUBSCRIBER; </ fullResult>
<status> fehlgeschlagen </ status>
</ log>
</ LogItems>

<? xml version \u003d'1 .0 'encoding \u003d "ISO-8859-1" standalone \u003d "no">
<LogItems>
<log logid\u003d"83efeae5190811100802120958">
<category> Upstream.CAI </ Kategorie>
<operation> Get </ Operation>
<target> DSUB </ target>
<Instanz> </ Beispiel>
<user> server1 </ user>
<context> SOG </ context>
<fullOperation> GETSUB: mdn, 989352375449; </ fullOperation>
<starttime> 20081110080212,352053 </ starttime>
<stoptime> 20081110080213,376720 </ stoptime>
<fullResult> RESP: 0: mdn, 989352375449: CODE, 432350114484630: Land, FI: LANG, fi: PRE, 0: SUBNAME, Eserve: MMS, 1; </ fullResult>
<status> ERFOLGREICHEN </ status>
</ log>
</ LogItems>

<? xml version \u003d'1 .0 'encoding \u003d "ISO-8859-1" standalone \u003d "no">
<LogItems>
<log logid\u003d"83efeae5190811100802350959">
<category> Upstream.CAI </ Kategorie>
<operation> Get </ Operation>
<target> ACCOUNTINFORMATION </ target>
<Instanz> </ Beispiel>
<user> server1 </ user>
<context> SOG </ context>
<fullOperation> GET: ACCOUNTINFORMATION: SubscriberNumber, 989352375449; </ fullOperation>
<starttime> 20081110080235,264165 </ starttime>
<stoptime> 20081110080235,555880 </ stoptime>
<fullResult> RESP: -3010; </ fullResult>
<status> fehlgeschlagen </ status>
</ log>
<log logid\u003d"83efeae5190811100802450960">
<category> Upstream.CAI </ Kategorie>
<operation> Löschen </ Operation>
<target> EDSUB </ target>
<Instanz> </ Beispiel>
<user> server1 </ user>
<context> SOG </ context>
<fullOperation> DELETE: EDSUB: CODE, 432350114484630: mdn, 989352375449: PRE, 0EST, alle; </ fullOperation>
<starttime> 20081110080245,012208 </ starttime>
<stoptime> 20081110080245,857994 </ stoptime>
<fullResult> RESP: 0; </ fullResult>
<status> ERFOLGREICHEN </ status>
</ log>
<log logid\u003d"83efeae5190811100802510961">
<category> Upstream.CAI </ Kategorie>
<operation> erstellen </ Operation>
<target> EDSUB </ target>
<Instanz> </ Beispiel>
<user> server1 </ user>
<context> SOG </ context>
<fullOperation> CREATE: EDSUB: CODE, 432350114484630: KI, 1C9B39AAF3931D60C064F6E8FBB5B1E6: mdn, 98935237544 9: PRE, 0EST, alle; </ fullOperation>
<starttime> 20081110080251,089898 </ starttime>
<stoptime> 20081110080251,489396 </ stoptime>
<fullResult> RESP: 911364896; </ fullResult>
<status> fehlgeschlagen </ status>
</ log>
<log logid\u003d"83efeae5190811100802540962">
<category> Upstream.CAI </ Kategorie>
<operation> Get </ Operation>
<target> ESUB </ target>
<Instanz> CODE \u003d 432350114484630 </ Beispiel>
<user> server1 </ user>
<context> SOG </ context>
<fullOperation> GET: ESUB: CODE, 432350114484630; </ fullOperation>
<starttime> 20081110080254,000313 </ starttime>
<stoptime> 20081110080254,697545 </ stoptime>
<fullResult> RESP: 0: mdn, 989352375449: CODE, 432350114484630: T11, 1: T21, 1: T22, 1: B16, 1: T62, 1: BAIC, 0: BAOC, 0: BOIC, 0: BIRO, 0 : BORO, 0: BOIH, 0: BOS4, 0: CLIP, 1: CLIR, 0: CFB, 1: CFNR, 1: CFNA, 1: KBE, 1: HOLD, 1: CW, 1: MPTY, 1: BAICS , 0,0: BAOCS, 0,0: BOICS, 0,0: PRE, 0; </ fullResult>
<status> ERFOLGREICHEN </ status>
</ log>
<log logid\u003d"83efeae5190811100802570963">
<category> Upstream.CAI </ Kategorie>
<operation> Set </ Operation>
<target> DSUB </ target>
<Instanz> </ Beispiel>
<user> server1 </ user>
<context> SOG </ context>
<fullOperation> SETSUB: mdn, 989352375449; </ fullOperation>
<starttime> 20081110080257,888204 </ starttime>
<stoptime> 20081110080257,999121 </ stoptime>
<fullResult> RESP: 911265678; </ fullResult>
<status> fehlgeschlagen </ status>
</ log>
</ LogItems>
  #2 (permalink)  
Old 11-17-2008
thepurple thepurple is offline
Registrierte Nutzer
  
 

Join Date: Oct 2007
Beiträge: 134
unter Befehle ich. Aber nicht immer die richtige Ausgabe. Aber es dauert 3 Minuten für die 35MB-Datei. Aber ich habe 900MB-Datei

egrep '<fullOperation> DELETE | <fullOperation> SET | <fullOperation> CREATE | <fullOperation> GET | <fullResult> RESP "

Ausgang war -

<fullOperation> GET: ESUB: mdn, 989371072136; </ fullOperation>
<fullResult> RESP: 0: mdn, 989371072136: CODE, 432350022011344: NACHNAME, 989371072136: FIRSTNAME ,2008-11-08_16_10: Land, IR: LANG, FA: PRE, 1: SUBNAME, Eserve: MMS, 0; </ fullResult >
<fullResult> RESP: 0; </ fullResult>
<fullResult> RESP: 0; </ fullResult> -> Inhalt: kommt zweimal


Leistung sollte -
GET
Inhalt: 0
  #3 (permalink)  
Old 11-17-2008
radoulov's Avatar
radoulov radoulov is offline Forum Staff  
addict
  
 

Join Date: Jan 2007
Lage: Варна, България / Milano, Italia
Posts: 2915
Ja,
die Beispieldaten in den vorangegangenen Bedrohung war anders (Ich war der Annahme, Tags, getrennt durch Leerzeichen (leer) Zeilen).
Versuchen Sie folgendes:


Code:
perl -nle'BEGIN {$/="</log>";$,="\n";$\="\n\n"}
  print /<fullOperation>(.*?):.*<fullResult>(.*?:.*?)[:;]/s
  ' infile

  #4 (permalink)  
Old 11-17-2008
thepurple thepurple is offline
Registrierte Nutzer
  
 

Join Date: Oct 2007
Beiträge: 134
Oaoo Greate ihre Arbeitsweise. Ich möchte die Leistung in den Dateien.

Ich habe es wie unten. Aber output.txt enthält einige Strings, die nicht mit mit Original-Ausgabe in meinem Bildschirm

perl NLE-"BEGIN {$/\u003d"</ Log->";$,\u003d" \ n"; $ \ \u003d "\ n \ n") print / <fullOperation> (.*?):.*< fullResult> ( .*?:.*?)[:;]/ n "2008-11-11.0.log > Output.txt
  #5 (permalink)  
Old 11-17-2008
radoulov's Avatar
radoulov radoulov is offline Forum Staff  
addict
  
 

Join Date: Jan 2007
Lage: Варна, България / Milano, Italia
Posts: 2915
Das ist seltsam, könnten Sie ein Beispiel für die Saiten?
  #6 (permalink)  
Old 11-17-2008
thepurple thepurple is offline
Registrierte Nutzer
  
 

Join Date: Oct 2007
Beiträge: 134
Opss ich wirklich leid Buddy .. Es funktionierte. In der Tat habe ich die falsche Datei.

Wie dem auch sei, ich hoffe, ich kann die 'N' Anzahl der Dateinamen mit dem perl Skript.

perl NLE-"BEGIN {$/\u003d"</ Log->";$,\u003d" \ n"; $ \ \u003d "\ n \ n") print / <fullOperation> (.*?):.*< fullResult> ( .*?:.*?)[:;]/ s' logfile1 logflie2 ... logfileN
  #7 (permalink)  
Old 11-17-2008
radoulov's Avatar
radoulov radoulov is offline Forum Staff  
addict
  
 

Join Date: Jan 2007
Lage: Варна, България / Milano, Italia
Posts: 2915
Sie können.
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 11:30 AM.


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