PDA

View Full Version : For those who know linux


Daddy_Digital
07-13-2010, 07:53 PM
need alil help with a script. i need to write a script that takes a colon-seperated list of items and outputs the items, one per line, to standard output (without the colons)

any help would be appreciated.

VTECin5th
07-14-2010, 05:40 AM
#!/usr/bin/perl
@data = "item:item2:item3";
foreach $item (@data){
split ("\:", $item);
chomp($item); #(remove trailing whitespace or newline problems, might be chop, it's been awhile.)
print $item . "\n";
}
Perl code.
Untested, may need tweeking, Im almost asleep.

Daddy_Digital
07-14-2010, 10:53 AM
#!/usr/bin/perl
@data = "item:item2:item3";
foreach $item (@data){
split ("\:", $item);
chomp($item); #(remove trailing whitespace or newline problems, might be chop, it's been awhile.)
print $item . "\n";
}
Perl code.
Untested, may need tweeking, Im almost asleep.

thanks for this. me and my partner tried something else. i kinda forgot how it went.i was so tired and frustrated with this lol