The UNIX and Linux Forums  

Go Back   UNIX og Linux Forums > Top Forums > Shell Programmering og Scripting
.
google unix.com


Shell Programmering og Scripting Post spørgsmål om ksh, CSH, SH, Bash, Perl, PHP, SED, AWK og ANDRE shell scripts og Shell scriptsprog her.

Mere UNIX og Linux Forum Emner du måske kan finde Helpful
Tråd Thread Starter Forum Svar Last Post
ksh scripting hjælpe praveenbvarrier Shell Programmering og Scripting 1 04-15-2008 11:19 AM
SQL scripting hjælpe sam786 Shell Programmering og Scripting 3 12-10-2007 12:31 PM
Forskellen mellem AIX shell scripting og Unix shell-scripting. haroonec Shell Programmering og Scripting 2 04-12-2006 09:12 AM
scripting guru's pls hjælpe mig med scripting på AIX thatiprashant Shell Programmering og Scripting 1 01-20-2006 07:58 PM
Scripting? woofie Hvad tænker du på? 1 03-09-2005 07:03 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Søg denne tråd Rate Thread Display Modes
  #1 (permalink)  
Old 11-21-2007
noamb noamb is offline
Registreret Bruger
  
 

Join Date: Nov 2007
Stillinger: 1
behovet scripting hjælpe

Hej alle,

Jeg har brug for at skrive et script, der vil agere på output formateret som følgende eksempel:

AFP: state \u003d "Running"
AFP: usersArray: _array_index: 0: disconnectID \u003d 0
AFP: usersArray: _array_index: 0: sessionid \u003d 3423
AFP: usersArray: _array_index: 0: minsToDisconnect \u003d 0
AFP: usersArray: _array_index: 0: flags \u003d 0
AFP: usersArray: _array_index: 0: state \u003d 6
AFP: usersArray: _array_index: 0: loginElapsedTime \u003d 89731
AFP: usersArray: _array_index: 0: name \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: Ipaddress \u003d "10.0.3.36"
AFP: usersArray: _array_index: 1: disconnectID \u003d 0
AFP: usersArray: _array_index: 1: sessionid \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: name \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: Ipaddress \u003d "10.0.3.136"
AFP: usersArray: _array_index: 2: disconnectID \u003d 0
AFP: usersArray: _array_index: 2: sessionid \u003d 3609
AFP: usersArray: _array_index: 2: minsToDisconnect \u003d 0
AFP: usersArray: _array_index: 2: flags \u003d 0
AFP: usersArray: _array_index: 2: status \u003d 1
AFP: usersArray: _array_index: 2: loginElapsedTime \u003d 69026
AFP: usersArray: _array_index: 2: name \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: Ipaddress \u003d "10.0.3.36"
AFP: usersArray: _array_index: 3: disconnectID \u003d 0
AFP: usersArray: _array_index: 3: sessionid \u003d 3664
AFP: usersArray: _array_index: 3: minsToDisconnect \u003d 0
AFP: usersArray: _array_index: 3: flags \u003d 0
AFP: usersArray: _array_index: 3: status \u003d 1
AFP: usersArray: _array_index: 3: loginElapsedTime \u003d 5745
AFP: usersArray: _array_index: 3: name \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: Ipaddress \u003d "10.0.3.56"
AFP: usersArray: _array_index: 4: disconnectID \u003d 0
AFP: usersArray: _array_index: 4: sessionid \u003d 3666
AFP: usersArray: _array_index: 4: minsToDisconnect \u003d 0
AFP: usersArray: _array_index: 4: flags \u003d 0
AFP: usersArray: _array_index: 4: status \u003d 1
AFP: usersArray: _array_index: 4: loginElapsedTime \u003d 5743
AFP: usersArray: _array_index: 4: name \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: Ipaddress \u003d "10.0.3.56"
AFP: usersArray: _array_index: 5: disconnectID \u003d 0
AFP: usersArray: _array_index: 5: sessionid \u003d 3698
AFP: usersArray: _array_index: 5: minsToDisconnect \u003d 0
AFP: usersArray: _array_index: 5: flags \u003d 0
AFP: usersArray: _array_index: 5: status \u003d 1
AFP: usersArray: _array_index: 5: loginElapsedTime \u003d 2276
AFP: usersArray: _array_index: 5: name \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: Ipaddress \u003d "10.0.3.33"
AFP: usersArray: _array_index: 6: disconnectID \u003d 0
AFP: usersArray: _array_index: 6: sessionid \u003d 3700
AFP: usersArray: _array_index: 6: minsToDisconnect \u003d 0
AFP: usersArray: _array_index: 6: flags \u003d 0
AFP: usersArray: _array_index: 6: status \u003d 1
AFP: usersArray: _array_index: 6: loginElapsedTime \u003d 2273
AFP: usersArray: _array_index: 6: name \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: Ipaddress \u003d "10.0.3.33"
AFP: usersArray: _array_index: 7: disconnectID \u003d 0
AFP: usersArray: _array_index: 7: sessionid \u003d 3705
AFP: usersArray: _array_index: 7: minsToDisconnect \u003d 0
AFP: usersArray: _array_index: 7: flags \u003d 1
AFP: usersArray: _array_index: 7: status \u003d 1
AFP: usersArray: _array_index: 7: loginElapsedTime \u003d 607
AFP: usersArray: _array_index: 7: name \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: Ipaddress \u003d "10.0.3.28"
AFP: usersArray: _array_index: 8: disconnectID \u003d 0
AFP: usersArray: _array_index: 8: sessionid \u003d 3707
AFP: usersArray: _array_index: 8: minsToDisconnect \u003d 0
AFP: usersArray: _array_index: 8: flags \u003d 1
AFP: usersArray: _array_index: 8: status \u003d 1
AFP: usersArray: _array_index: 8: loginElapsedTime \u003d 606
AFP: usersArray: _array_index: 8: name \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: Ipaddress \u003d "10.0.3.28"
AFP: timestamp \u003d "2007-11-21 10:05:40 -0800"


Scriptet er behov for:

1. finde nogen linje, der slutter med "state \u003d 6"
2. udpakke "array_index:" nummer fra denne linje
3. udpakke "sessionid" af, at array_index fra en anden linje

Dette går ud over min viden om grep og awk. Jeg vil bruge awk undtagen jeg kun ved, hvordan de skal handle på kolonner, og da der ingen blanktegn omkring array_index værdi I'm stumped! Kan du hjælpe?

Tak!
Noam
 

Bogmærker

Thread Tools Søg denne tråd
Søg denne tråd:

Avanceret søgning
Display Modes Bedøm denne tråd
Bedøm denne tråd:

Udstationering Regler
Du kan ikke post nye tråde
Du kan ikke post svar
Du kan ikke post vedhæftede filer
Du kan ikke redigere dine indlæg

BB-kode er
Smilies er
[IMG] koden er
HTML-koden er Slukket
Trackbacks er
Pingbacks er
Refbacks er




Alle tidspunkter er GMT -4. Den tid er nu 03:02 PM.


Powered by: vBulletin, Copyright © 2000 - 2006, Jelsoft Enterprises Limited. Oversættelser Powered by .
vBCredits v1.4 Copyright © 2007 - 2008, PixelFX Studios
UNIX og Linux Forums Indhold Copyright © 1993-2009. All rights reserved.

Content Relevant webadresser ved vBSEO 3.2.0