The UNIX and Linux Forums  

Go Back   De Unix-en Linux Forum > Top Forums > Programmeren en Shell Scripting
.
google unix.com



Programmeren en Shell Scripting Post vragen over KSH, CSH, SH, Bash, Perl, PHP, sed, awk en andere shell scripts en shell scripting talen hier.

Meer UNIX en Linux Forum Onderwerpen Misschien vindt u Helpful
Draad Thread Starter Forum Antwoorden Last Post
ksh scripting helpen praveenbvarrier Programmeren en Shell Scripting 1 04-15-2008 11:19
SQL scripting helpen sam786 Programmeren en Shell Scripting 3 12-10-2007 12:31
verschil tussen AIX shell scripting en Unix shell scripting. haroonec Programmeren en Shell Scripting 2 04-12-2006 09:12
scripting goeroe's pls help me met scripting op AIX thatiprashant Programmeren en Shell Scripting 1 01-20-2006 07:58 PM
Scripting? woofie What's On Your Mind? 1 03-09-2005 07:03

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Zoeken in deze Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-21-2007
noamb noamb is offline
Geregistreerde gebruiker
  
 

Join Date: november 2007
Krabbels: 1
moet scripting helpen

Hallo allemaal,

Ik moet een script schrijven dat zal optreden op de output geformatteerd als het volgende voorbeeld:

AFP: stand \u003d "RUNNING"
AFP: usersArray: _array_index: 0: disconnectID \u003d 0
AFP: usersArray: _array_index: 0: sessie \u003d 3423
AFP: usersArray: _array_index: 0: minsToDisconnect \u003d 0
AFP: usersArray: _array_index: 0: flags \u003d 0
AFP: usersArray: _array_index: 0: stand \u003d 6
AFP: usersArray: _array_index: 0: loginElapsedTime \u003d 89731
AFP: usersArray: _array_index: 0: naam \u003d "maryallen"
AFP: usersArray: _array_index: 0: lastUseElapsedTime \u003d 89725
AFP: usersArray: _array_index: 0: serviceType \u003d "AFP"
AFP: usersArray: _array_index: 0: sessionType \u003d "TCP"
AFP: usersArray: _array_index: 0: ipadres \u003d "10.0.3.36"
AFP: usersArray: _array_index: 1: disconnectID \u003d 0
AFP: usersArray: _array_index: 1: sessie \u003d 3573
AFP: usersArray: _array_index: 1: minsToDisconnect \u003d 0
AFP: usersArray: _array_index: 1: flags \u003d 0
AFP: usersArray: _array_index: 1: state \u003d 6
AFP: usersArray: _array_index: 1: loginElapsedTime \u003d 72783
AFP: usersArray: _array_index: 1: naam \u003d "ILS"
AFP: usersArray: _array_index: 1: lastUseElapsedTime \u003d 68964
AFP: usersArray: _array_index: 1: serviceType \u003d "AFP"
AFP: usersArray: _array_index: 1: sessionType \u003d "TCP"
AFP: usersArray: _array_index: 1: ipadres \u003d "10.0.3.136"
AFP: usersArray: _array_index: 2: disconnectID \u003d 0
AFP: usersArray: _array_index: 2: sessie \u003d 3609
AFP: usersArray: _array_index: 2: minsToDisconnect \u003d 0
AFP: usersArray: _array_index: 2: flags \u003d 0
AFP: usersArray: _array_index: 2: state \u003d 1
AFP: usersArray: _array_index: 2: loginElapsedTime \u003d 69026
AFP: usersArray: _array_index: 2: naam \u003d "samanthacovey"
AFP: usersArray: _array_index: 2: lastUseElapsedTime \u003d 36404
AFP: usersArray: _array_index: 2: serviceType \u003d "AFP"
AFP: usersArray: _array_index: 2: sessionType \u003d "TCP"
AFP: usersArray: _array_index: 2: ipadres \u003d "10.0.3.36"
AFP: usersArray: _array_index: 3: disconnectID \u003d 0
AFP: usersArray: _array_index: 3: sessie \u003d 3664
AFP: usersArray: _array_index: 3: minsToDisconnect \u003d 0
AFP: usersArray: _array_index: 3: flags \u003d 0
AFP: usersArray: _array_index: 3: stand \u003d 1
AFP: usersArray: _array_index: 3: loginElapsedTime \u003d 5745
AFP: usersArray: _array_index: 3: naam \u003d "dawndawson"
AFP: usersArray: _array_index: 3: lastUseElapsedTime \u003d 1
AFP: usersArray: _array_index: 3: serviceType \u003d "AFP"
AFP: usersArray: _array_index: 3: sessionType \u003d "TCP"
AFP: usersArray: _array_index: 3: ipadres \u003d "10.0.3.56"
AFP: usersArray: _array_index: 4: disconnectID \u003d 0
AFP: usersArray: _array_index: 4: sessie \u003d 3666
AFP: usersArray: _array_index: 4: minsToDisconnect \u003d 0
AFP: usersArray: _array_index: 4: flags \u003d 0
AFP: usersArray: _array_index: 4: state \u003d 1
AFP: usersArray: _array_index: 4: loginElapsedTime \u003d 5743
AFP: usersArray: _array_index: 4: naam \u003d "dawndawson"
AFP: usersArray: _array_index: 4: lastUseElapsedTime \u003d 519
AFP: usersArray: _array_index: 4: serviceType \u003d "AFP"
AFP: usersArray: _array_index: 4: sessionType \u003d "TCP"
AFP: usersArray: _array_index: 4: ipadres \u003d "10.0.3.56"
AFP: usersArray: _array_index: 5: disconnectID \u003d 0
AFP: usersArray: _array_index: 5: sessie \u003d 3698
AFP: usersArray: _array_index: 5: minsToDisconnect \u003d 0
AFP: usersArray: _array_index: 5: flags \u003d 0
AFP: usersArray: _array_index: 5: state \u003d 1
AFP: usersArray: _array_index: 5: loginElapsedTime \u003d 2276
AFP: usersArray: _array_index: 5: naam \u003d "kateberrigan"
AFP: usersArray: _array_index: 5: lastUseElapsedTime \u003d 0
AFP: usersArray: _array_index: 5: serviceType \u003d "AFP"
AFP: usersArray: _array_index: 5: sessionType \u003d "TCP"
AFP: usersArray: _array_index: 5: ipadres \u003d "10.0.3.33"
AFP: usersArray: _array_index: 6: disconnectID \u003d 0
AFP: usersArray: _array_index: 6: sessie \u003d 3700
AFP: usersArray: _array_index: 6: minsToDisconnect \u003d 0
AFP: usersArray: _array_index: 6: flags \u003d 0
AFP: usersArray: _array_index: 6: state \u003d 1
AFP: usersArray: _array_index: 6: loginElapsedTime \u003d 2273
AFP: usersArray: _array_index: 6: naam \u003d "kateberrigan"
AFP: usersArray: _array_index: 6: lastUseElapsedTime \u003d 1604
AFP: usersArray: _array_index: 6: serviceType \u003d "AFP"
AFP: usersArray: _array_index: 6: sessionType \u003d "TCP"
AFP: usersArray: _array_index: 6: ipadres \u003d "10.0.3.33"
AFP: usersArray: _array_index: 7: disconnectID \u003d 0
AFP: usersArray: _array_index: 7: sessie \u003d 3705
AFP: usersArray: _array_index: 7: minsToDisconnect \u003d 0
AFP: usersArray: _array_index: 7: flags \u003d 1
AFP: usersArray: _array_index: 7: \u003d 1
AFP: usersArray: _array_index: 7: loginElapsedTime \u003d 607
AFP: usersArray: _array_index: 7: naam \u003d "sabrinaschwartz"
AFP: usersArray: _array_index: 7: lastUseElapsedTime \u003d 1
AFP: usersArray: _array_index: 7: serviceType \u003d "AFP"
AFP: usersArray: _array_index: 7: sessionType \u003d "TCP"
AFP: usersArray: _array_index: 7: ipadres \u003d "10.0.3.28"
AFP: usersArray: _array_index: 8: disconnectID \u003d 0
AFP: usersArray: _array_index: 8: sessie \u003d 3707
AFP: usersArray: _array_index: 8: minsToDisconnect \u003d 0
AFP: usersArray: _array_index: 8: flags \u003d 1
AFP: usersArray: _array_index: 8: state \u003d 1
AFP: usersArray: _array_index: 8: loginElapsedTime \u003d 606
AFP: usersArray: _array_index: 8: naam \u003d "sabrinaschwartz"
AFP: usersArray: _array_index: 8: lastUseElapsedTime \u003d 207
AFP: usersArray: _array_index: 8: serviceType \u003d "AFP"
AFP: usersArray: _array_index: 8: sessionType \u003d "TCP"
AFP: usersArray: _array_index: 8: ipadres \u003d "10.0.3.28"
AFP: TimeStamp \u003d "2007-11-21 10:05:40 -0800"


Het script moet:

1. enkele regel die eindigt met "state \u003d 6"
2. extract van de "array_index:" nummer van die lijn
3. extract van de "sessie" van dat array_index uit een andere lijn

Dit gaat verder dan mijn kennis van grep en awk. Ik zou gebruik awk behalve ik alleen weten hoe te handelen op de kolommen, en aangezien er geen witruimte rond de array_index waarde I'm stumped! Kunt u mij helpen?

Bedankt!
Noam
 

Bladwijzers

Thread Tools Zoeken in deze Thread
Zoeken in deze Thread:

Uitgebreid zoeken
Display Modes Beoordeel deze draad
Beoordeel deze draad:

Posting Regels
Jij mag niet Post Nieuwe threads
Jij mag niet na antwoorden
Jij mag niet post attachments
Jij mag niet bewerk uw berichten

BB code is Aan
Smilies zijn Aan
[IMG] code Aan
HTML-code is Uit
Trackbacks zijn Aan
Pingbacks zijn Aan
Refbacks zijn Aan




Alle tijden zijn GMT -4. Het is nu 11:24.


Powered by: vBulletin, Copyright © 2000 - 2006, Jelsoft Enterprises Limited. Vertalingen Powered by .
vBCredits v1.4 Copyright © 2007 - 2008, PixelFX Studios
De Unix-en Linux Forums Copyright © 1993-2009. Alle rechten Reserved.Ad Beheer door RedTyger

Content Relevante URL's door vBSEO 3.2.0