The UNIX and Linux Forums  

Go Back   UNIX e Linux Forum > Inizio Forum > Shell scripting e di programmazione
.
google unix.com



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
Recupera 5. Campo di ultimo campo! jobbyjoseph UNIX for Dummies Domande & Risposte 3 05-16-2007 04:20 AM
Spostamento di parte di un campo ad un altro campo utilizzando AWK rjsha1 Shell scripting e di programmazione 5 08-04-2006 06:39 AM
Delimitato file hrshah74 Shell scripting e di programmazione 4 02-01-2006 12:42 PM
Conversione di file delimitato da scheda a delimitato il file in Unix charan81 Shell scripting e di programmazione 22 01-20-2006 09:24 AM
aggiungere incremento campo quando primo campo modifiche azekry Shell scripting e di programmazione 2 11-14-2005 04:21 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 Cerca in questo Thread Rate Thread Modalità di visualizzazione
  #1 (permalink)  
Old 10-19-2007
rauphelhunter rauphelhunter is offline
Utente Registrato
  
 

Iscriviti Data: ottobre 2007
Interventi: 23
Come perfrom sommatoria di particolare delimitato settore?

Salve,

Vi preghiamo di contribuire a condividere il tuo pensiero su come sommatoria di perfrom particolare delimitato settore, e di uscita per il file particolare sulla base di

Codice HTML:
-rw-r--r--   1 abc   other          3094 Oct 19 09:40 0132019832-ps5_online_cdrm.unl
-rw-r--r--   1 abc   other          1588 Oct 19 09:47 0132019832-ps5_online_cdrn.unl
-rw-r--r--   1 abc   other          2523 Oct 19 09:54 0132019832-ps5_online_cdro.unl
-rw-r--r--   1 abc   other           947 Oct 19 10:01 0132019832-ps5_online_cdrp.unl
-rw-r--r--   1 abc   other          1300 Oct 19 10:09 0132019832-ps5_online_cdrq.unl
-rw-r--r--   1 abc   other           410 Oct 19 10:16 0132019832-ps5_online_cdrr.unl
-rw-r--r--   1 abc   other          4253 Oct 19 10:23 0132019832-ps5_online_cdrs.unl
-rw-r--r--   1 abc   other         10195 Oct 19 10:31 0132019832-ps5_online_cdrt.unl
-rw-r--r--   1 abc   other          1053 Oct 19 10:38 0132019832-ps5_online_cdru.unl
Ogni file contenuto in questo modo in cui separati con delimitatore "|".
Codice HTML:
1603823|010|4|CDR|0132019832|||3002|0194212739|||||||N|Y|Y|2007-08-30 23:42:42|||17||-0.1|16.5951|||MO019|-0.1|16.5951|0|||
1603863|010|4|CDR|0132019832|||3002|01997564444|||||||N|Y|Y|2007-08-30 23:42:53|||14||-0.1|16.4251|||MO019|-0.1|16.4251|0|||
1603912|010|4|CDR|0132019832|||3005|0135305303|||||||N|Y|Y|2007-08-30 23:43:07|||9||-0.1|16.1851||3GMid|MO013|-0.1|16.1851|0|||
1603930|010|4|CDR|0132019832|||3002|0192504561|||||||N|Y|Y|2007-08-30 23:43:13|||17||-0.1|16.0851|||MO019|-0.1|16.0851|0|||
1603948|010|4|CDR|0132019832|||3004|0126440226|||||||N|Y|Y|2007-08-30 23:43:18|||15||-0.2|15.8851|||MO012|-0.2|15.8851|0|||
1603975|010|4|CDR|0132019832|||3007|0175152680|||||||N|Y|Y|2007-08-30 23:43:28|||13||-0.2|15.6151|||MO017|-0.2|15.6151|0|||
1603996|010|4|CDR|0132019832|||3004|0125329005|||||||N|Y|Y|2007-08-30 23:43:34|||18||-0.2|15.4151|||MO012|-0.2|15.4151|0|||
1604034|010|4|CDR|0132019832|||3005|0137508649|||||||N|Y|Y|2007-08-30 23:43:44|||11||-0.1|15.2451|||MO013|-0.1|15.2451|0|||
Il risultato finale di tutti i valori in campo 24 sarà riassunto in un file di output e a.txt dire, mentre il settore 5 e valore totale devono essere separate da "|"

Dire quando gatto uscita (a.txt)
0132019832 | -1,1


Hai bisogno di aiuto ...!
  #2 (permalink)  
Old 10-19-2007
ghostdog74 ghostdog74 is offline Forum Advisor  
Utente Registrato
  
 

Join Date: Sep 2006
Interventi: 2.557

Codice:
awk 'BEGIN{FS="|"}
{
 a[$5]=a[$5]+$24
}
END {
     for (i in a) print a[i]"|"i > "outfile"
}
' "file"

solo per un unico file.
  #3 (permalink)  
Old 10-19-2007
rauphelhunter rauphelhunter is offline
Utente Registrato
  
 

Iscriviti Data: ottobre 2007
Interventi: 23
Hi ghostdog74, Funziona! ..

Chiunque altro know-how per eseguire più file?

Saluti,
Closed Thread

Segnalibri

Thread Tools Cerca in questo Thread
Cerca in questo Thread:

Ricerca Avanzata
Modalità di visualizzazione Vota questo thread
Vota questo thread:

Distacco regolamento
Tu non può post nuovo thread
Tu non può inviare una risposta
Tu non può postare allegati
Tu non può modificare i tuoi post

BB codice è Su
Smilies sono Su
[IMG] codice Su
Codice HTML è Chiuso
Trackbacks sono Su
Pingbacks sono Su
Refbacks sono Su




Tutti gli orari sono GMT -4. La data di oggi è 08:10 PM.


Powered by: vBulletin, Copyright © 2000 - 2006, Jelsoft Enterprises Limited. Traduzioni Powered by .
vBCredits v1.4 Copyright © 2007 - 2008, PixelFX Studios
UNIX e Linux Forum Content Copyright © 1993-2009. Tutti i diritti Reserved.Ad di gestione da RedTyger

Contenuti pertinenti URL da vBSEO 3.2.0