[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Text Manipulation
Assuming what you want is 7 characters of text, then a space, until
you run out of characters on the line, something like this will work:
#!/usr/bin/perl
while (<>) {
my @chunks;
chomp;
while (length($_)) {
my $chunk = substr($_, 0, 7);
$_ = substr($_, length($chunk));
push(@chunks, $chunk);
}
print "@chunks\n";
}
Apparently my awk skills are quite up to rewriting that today or I'd
give you the awk equivalent.
Steve
--
steve@silug.org | Southern Illinois Linux Users Group
(618)398-7360 | See web site for meeting details.
Steven Pritchard | http://www.silug.org/
-
To unsubscribe, send email to majordomo@silug.org with
"unsubscribe silug-discuss" in the body.
- References:
- Text Manipulation
- From: Spearing Tyler Contractor USTC <Tyler.Spearing@hq.transcom.mil>