need to replace time value in different lines

14 views
Skip to first unread message

Kaarle Kannelmäe

unread,
Jun 18, 2013, 2:44:47 PM6/18/13
to bbe...@googlegroups.com
Hi all

 i have a problem i cannot solve myself..
i'm using Textwrangler and i need put new time values:

00:00
00:16
00:42
04:01
05:27
07:51
08:59
11:37
12:52
14:23
15:06
16:32
17:17
17:37
18:09
18:32
18:39
19:03

In the following code, replacing original time value:

show8_caton/slide01.jpg" time="00:00" />
show8_caton/slide02.jpg" time="00:25" />
show8_caton/slide03.jpg" time="01:15" />
show8_caton/slide04.jpg" time="01:57" />
show8_caton/slide05.jpg" time="03:21" />
show8_caton/slide06.jpg" time="05:48" />
show8_caton/slide07.jpg" time="07:27" />
show8_caton/slide08.jpg" time="08:22" />
show8_caton/slide09.jpg" time="10:43" />
show8_caton/slide10.jpg" time="12:39" />
show8_caton/slide11.jpg" time="14:35" />
show8_caton/slide12.jpg" time="17:06" />
show8_caton/slide13.jpg" time="18:14" />
show8_caton/slide14.jpg" time="19:14" />
show8_caton/slide15.jpg" time="20:07" />
show8_caton/slide16.jpg" time="20:31" />
show8_caton/slide15.jpg" time="20:34" />
show8_caton/slide16.jpg" time="21:30" />
show8_caton/slide17.jpg" time="22:53" />
show8_caton/slide18.jpg" time="25:13" />

How to accomplish such a task?

with regards
Kaarle

David Kelly

unread,
Jun 18, 2013, 3:51:26 PM6/18/13
to bbe...@googlegroups.com
http://www.barebones.com/support/textwrangler/faqs.html#rectangle looks to be your answer. However above you have 18 values to put in 20 spots. Perhaps you should delete the (possibly) duplicate slide15 and slide16?

--
David Kelly N4HHE, dke...@HiWAAY.net
============================================================
Whom computers would destroy, they must first drive mad.

John Delacour

unread,
Jun 18, 2013, 5:57:16 PM6/18/13
to bbe...@googlegroups.com
 
On 18/6/13 at 19:44, kaa...@rgb.ee (Kaarle Kannelmäe) wrote:

>i have a problem i cannot solve myself..
>i'm using Textwrangler and i need put new time values:

You have 20 lines and only 18 replacements, so your last two
lines will be unchanged if you use the following text filter.
You can find out in the manual where to put text filters and how
to use them.


#!/usr/bin/perl
use strict;
my @new_times = split /[\n\r]+/,
"00:00
00:16
00:42
04:01
05:27
07:51
08:59
11:37
12:52
14:23
15:06
16:32
17:17
17:37
18:09
18:32
18:39
19:03";
my $i = 0;
while (<>){
s/[0-9][0-9]:[0-9][0-9]/$new_times[$i]/ if $new_times[$i];
print;
$i++;
}

Reply all
Reply to author
Forward
0 new messages