Well, I'm not sure how to do this in a textfactory, but it is trivial in perl.
Below is a sample perl program that does what you want. To make this production
just change "<DATA>" to "<>" on the while line and use it as a unix filter.
(you also don't need
anything below "# desired output")
Good Luck,
Matt
#!/usr/bin/perl
printf( "%5s %5s %5s\n", 'data1', 'data2', 'data3' );
while ( $line = <DATA> ) {
chomp($line);
if ( $line =~ m|^data1=(.*?);\s+data2=(.*?);\s+data3=(.*?);| ) {
printf( "%5s %5s %5s\n", $1, $2, $3 );
}
}
# desired output
# data1 data2 data3
# 234.4 343.7 588.0
# 511.5 654.7 654.9
# 651.8 925.5 876.0
__END__
random
junk
in
file
data1=234.4; data2=343.7; data3=588.0;
data1=511.5; data2=654.7; data3=654.9;
data1=651.8; data2=925.1; data3=876.0;
On Mar 3, 2010, at 12:20 AM, yogert909 wrote:
> Hi, I am writing a textfactory which uses part of a line as a column
> header. I want to duplicate the first line of data and create the
> headers from that. Is there a way to tell BBedit to find/replace only
> the 1st match and not all matches? Here is the format:
>
>
> There are several lines of random
> text here then comes the data below.
>
> data1=234.4; data2=343.7; data3=588.0;
> data1=511.5; data2=654.7; data3=654.9;
> data1=651.8; data2=925.1; data3=876.0;
>
> format like this:
>
> data1 data2 data3
> 234.4 343.7 588.0
> 511.5 654.7 654.9
> 651.8 925.5 876.0
> Edit/Delete Message
>
--
You received this message because you are subscribed to the
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
If you have a feature request or would like to report a problem,
please email "[email protected]" rather than posting to the group.