![]() |
|
|
google unix.com
|
|||||||
| Forum | Registrati | Regole Forum | Collegamenti | Album | FAQ | Members List | Calendario | Ricerca | Today's Posts | Mark Forums Read |
| Shell scripting e di programmazione Pubblica domande su KSH, CSH, SH, Bash, Perl, PHP, sed, awk e da altri script di shell e linguaggi di scripting shell qui. |
Più di UNIX e Linux Forum Argomenti potreste trovare utili
|
||||
| Filo | Thread Starter | Forum | Risposte | Ultimo Post |
| ksh scripting aiutare | praveenbvarrier | Shell scripting e di programmazione | 1 | 04-15-2008 11:19 AM |
| script SQL aiutare | sam786 | Shell scripting e di programmazione | 3 | 12-10-2007 12:31 PM |
| differenza tra AIX e Unix shell scripting di shell scripting. | haroonec | Shell scripting e di programmazione | 2 | 04-12-2006 09:12 AM |
| scripting guru del pls help me con lo scripting su AIX | thatiprashant | Shell scripting e di programmazione | 1 | 01-20-2006 07:58 PM |
| Scripting? | woofie | What's on Your Mind? | 1 | 03-09-2005 07:03 AM |
![]() |
|
|
LinkBack | Thread Tools | Cerca in questo Thread | Rate Thread | Modalità di visualizzazione |
|
|
|
||||
|
Aiuto con lo scripting
Ho 2 file con un comune parm - Jobname
File 1 0507 1202 JOBA 0507 1302 JOBB 0507 1452 JOBC 0507 1552 JOBA 0507 1553 JOBA File2 JOBA abcdefg server4 JOBB defghij server22 JOBC vwxyz12 server55 Vorrei approfittare di ogni riga da file1 e jobname la partita con il jobname in File 2 e come produrre file 3 0507 1202 JOBA abcdefg server4 0507 1302 JOBB defghij server22 0507 1452 JOBC vwxyz12 server55 0507 1552 JOBA abcdefg server4 0507 1553 JOBA abcdefg server4 Qualcuno potrebbe aiutare per favore, sono nuovo di scripting. |
|
||||
|
Codice:
nawk 'NR == FNR{rec[$1] = $2" " $3; next}
{ print $0 " " rec[$3]}
' 64491_merge1.d 64491_merge.d
uscita Codice:
0507 1202 JOBA abcdefg server4 0507 1302 JOBB defghij server22 0507 1452 JOBC vwxyz12 server55 0507 1552 JOBA abcdefg server4 0507 1553 JOBA abcdefg server4 |
|
||||
|
Dopo aver testato questo il semplice file a condizione che appare non funziona su più file complessato. Il primo file ha 6 campo separato da spazi vuoti
File1 LVTS4687 LVTSHPLON ltreb_shu1l110 LVTS4687 LVTSHPLON shu1l110 LVTS1457 LVTSHP sy_unix_live_rooma_onsite_35_35 LVTS1457 LVTSHP syhp10 LVTS5035 LVTSHP sy_unix_live_dmz_duplex_15_35 LVTS5035 LVTSHP srublae03-mgt LVTS1786 LVTSHPLON lmurb_shu1l282 LVTS1786 LVTSHPLON shu1l282-sy LVTS5431 LVTSHPLON lmurb_shu1l282 LVTS5431 LVTSHPLON shu1l282-sy LVTS5750 LVTSHP nw_unix_live_dmz_duplex_35_35 LVTS5750 LVTSHP NRUCCAE09-MGT LVTS5430 LVTSHP nw_unix_live_dmz_duplex_15_35 LVTS5430 LVTSHP nwhp3 LVTS4021 LVTSHP nw_unix_live_phase4_duplex_35_90 LVTS4021 LVTSHP nhu1u282 Il secondo file, dispone di 5 campi Fascicolo 2 0508 0601 LVTS4687 58 1 0509 0108 LVTS4687 58 1 0509 0108 LVTS4687 58 1 0509 0108 LVTS4687 58 1 0508 2206 LVTS5035 98 1 0508 2206 LVTS5035 98 1 0508 2206 LVTS5035 98 1 0508 2206 LVTS5430 98 1 0508 2206 LVTS5430 98 1 0508 2206 LVTS5430 98 1 0508 2206 LVTS5431 98 1 0508 2206 LVTS5431 98 1 0508 2206 LVTS5431 98 1 0506 0920 LVTS5750 141 3 0506 0920 LVTS5750 141 3 0506 0920 LVTS5750 141 3 0506 0920 LVTS5750 141 3 0506 0920 LVTS5750 141 3 0506 0920 LVTS5750 141 3 e il risultato dovrebbe apparire come File3 0508 0601 LVTS4687 58 1 ltreb_shu1l110 shu1l110 0509 0108 LVTS4687 58 1 ltreb_shu1l110 shu1l110 0509 0108 LVTS4687 58 1 ltreb_shu1l110 shu1l110 0509 0108 LVTS4687 58 1 ltreb_shu1l110 shu1l110 0508 2206 LVTS5035 98 1 sy_unix_live_dmz_duplex_15_35 srublae03-mgt 0508 2206 LVTS5035 98 1 sy_unix_live_dmz_duplex_15_35 srublae03-mgt 0508 2206 LVTS5035 98 1 sy_unix_live_dmz_duplex_15_35 srublae03-mgt 0508 2206 LVTS5430 98 1 nw_unix_live_dmz_duplex_15_35 nwhp3 0508 2206 LVTS5430 98 1 nw_unix_live_dmz_duplex_15_35 nwhp3 0508 2206 LVTS5430 98 1 nw_unix_live_dmz_duplex_15_35 nwhp3 0508 2206 LVTS5431 98 1 lmurb_shu1l282 shu1l282-sy 0508 2206 LVTS5431 98 1 lmurb_shu1l282 shu1l282-sy 0508 2206 LVTS5431 98 1 lmurb_shu1l282 shu1l282-sy 0506 0920 LVTS5750 141 3 nw_unix_live_dmz_duplex_35_35 NRUCCAE09-MGT 0506 0920 LVTS5750 141 3 nw_unix_live_dmz_duplex_35_35 NRUCCAE09-MGT 0506 0920 LVTS5750 141 3 nw_unix_live_dmz_duplex_35_35 NRUCCAE09-MGT 0506 0920 LVTS5750 141 3 nw_unix_live_dmz_duplex_35_35 NRUCCAE09-MGT 0506 0920 LVTS5750 141 3 nw_unix_live_dmz_duplex_35_35 NRUCCAE09-MGT 0506 0920 LVTS5750 141 3 nw_unix_live_dmz_duplex_35_35 NRUCCAE09-MGT questo file si compone di campo 1 2 3 4 5 di file2 e campo 3 e 6 del file1 |
![]() |
| Segnalibri |
| Tag |
| solaris |
| Thread Tools | Cerca in questo Thread |
| Modalità di visualizzazione | Vota questo thread |
|
|