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
Come conservare i valori in un file in un array risshanth UNIX for Dummies Domande & Risposte 3 01-22-2008 10:34 AM
Come leggere dal file txt e l'uso che, come un array Pinky UNIX for Dummies Domande & Risposte 4 10-08-2007 01:18 AM
creare array di caratteri di partecipazione sring then echo array. rorey_breaker Shell scripting e di programmazione 5 09-28-2007 09:42 AM
Dump un array in un file IMD Shell scripting e di programmazione 3 08-31-2006 11:04 AM
File di Array e Indietro. Boucho Di programmazione ad alto livello 1 02-14-2006 11:32 AM

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 02-08-2007
Rock Rock is offline
Utente Registrato
  
 

Join Date: Sep 2006
Interventi: 23
Da file di Array

Ciao a tutti,

Voglio lasciare il record da un file in un array. Che approccio posso usare?

ad esempio,
soruce_file:
aaa
bbb
ccc

array:
arr [0] \u003d aaa
arr [1] \u003d bbb
arr [2] \u003d ccc


Grazie,
Rock
  #2 (permalink)  
Old 02-08-2007
matrixmadhan matrixmadhan is online now Forum Advisor  
Technorati Master
  
 

Iscriviti Data: marzo 2005
Location: nodo foglia in B + tree
Messaggi: 2.958
Vorrei dare per garantito che aveva chiesto a perl


Codice:
#! /opt/third-party/bin/perl
                                                                              
open(FILE, "< filename") || die "Unable to open file. <$!>\n";
                                                                              
while( chomp($content = <FILE>) ) {
  push(@arr1, $content);
}
                                                                              
#If this needs to be displayed
foreach my $var(@arr1) {
  print "$var\n";
}
                                                                              
close(FILE);
                                                                              
exit 0

  #3 (permalink)  
Old 02-08-2007
Rock Rock is offline
Utente Registrato
  
 

Join Date: Sep 2006
Interventi: 23
thanks a lot
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 è 04:59 AM.


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