hi,
i have this data from the lab, it records the time like 10:00:00,100 (and record the next in 0,100 sec)
aftar the time comes the numbers from what it counts.
the problem is the program i used to record the counts, write it all in a single line, so now i'm trying to make a line break for every time recording.
i use macro, but after about 200 lines it always comes as a blank line, the rest of the data was erased.
edited:
(when i saved it the file is always 9,314MB...)
sorry, after i look at it again, the original file is 9,314kb, but after i put some line breaks, the file is only 33kb. (you can see that the rest of the data was erased)
is it some bug from textpad?
thx in advance.
-ark-
Macro problem with line break
Moderators: AmigoJack, bbadmin, helios, MudGuard
-
arkaden
- Posts: 4
- Joined: Mon Dec 03, 2007 12:35 pm
Macro problem with line break
Last edited by arkaden on Mon Dec 03, 2007 1:19 pm, edited 1 time in total.
-
ben_josephs
- Posts: 2464
- Joined: Sun Mar 02, 2003 9:22 pm
There is no way to view or edit a TextPad macro, so it's impossible to see exactly what your macro is doing.
You haven't described exactly what your data looks like. Does it look something like this:
10:00:00,100 42 56 76 99 10:00:00,200 42 56 76 99 10:00:00,300 42 56 76 99 10:00:00,400 42 56 76 99
?
If so, try using a regular expression search and replace:
You haven't described exactly what your data looks like. Does it look something like this:
10:00:00,100 42 56 76 99 10:00:00,200 42 56 76 99 10:00:00,300 42 56 76 99 10:00:00,400 42 56 76 99
?
If so, try using a regular expression search and replace:
This assumes you are using Posix regular expression syntax:Find what: *([0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3})
Replace with: \n\1
[X] Regular expression
Replace All
Configure | Preferences | Editor
[X] Use POSIX regular expression syntax
-
arkaden
- Posts: 4
- Joined: Mon Dec 03, 2007 12:35 pm
sorry, the data looks like this:
11.10.2007;13:57:01,900;20,74;20,44;20,75;20,12;21,00;21,30;21,44;21,24;35,03;20,74;11.10.2007;13:57:02,000;20,74;20,44;20,75;20,12;21,00;21,30;21,44;21,24;35,03;20,74;
i have to put a line breaker before the date (before 11.10.)
i use macro: after x times to the right put enter
what's strange is that i can do the macro 100 times, but in the next 100 times sometimes it worked, sometimes just half of it worked, the rest was only empty lines...
and if i do it manually, i put the cursor just before 11. and put enter, it worked normally.
after the error occured, normally i just close the file and open it again, play the macro 100 times, try another 100 times, if not worked than i close it again, open it again...
i tried to find and replace:
*([0-9]{2}.[0-9]{2}.[0-9]{4})
but it says: regular expression not found...
11.10.2007;13:57:01,900;20,74;20,44;20,75;20,12;21,00;21,30;21,44;21,24;35,03;20,74;11.10.2007;13:57:02,000;20,74;20,44;20,75;20,12;21,00;21,30;21,44;21,24;35,03;20,74;
i have to put a line breaker before the date (before 11.10.)
i use macro: after x times to the right put enter
what's strange is that i can do the macro 100 times, but in the next 100 times sometimes it worked, sometimes just half of it worked, the rest was only empty lines...
and if i do it manually, i put the cursor just before 11. and put enter, it worked normally.
after the error occured, normally i just close the file and open it again, play the macro 100 times, try another 100 times, if not worked than i close it again, open it again...
i tried to find and replace:
*([0-9]{2}.[0-9]{2}.[0-9]{4})
but it says: regular expression not found...
-
ben_josephs
- Posts: 2464
- Joined: Sun Mar 02, 2003 9:22 pm
Are you using Posix regular expression syntax? Is there a spurious space at the end of your regex?
(There should have been a space at the beginning of the regex I suggested. Sorry. But its omission will not stop it working in this case.)
Try
(There should have been a space at the beginning of the regex I suggested. Sorry. But its omission will not stop it working in this case.)
Try
Find what: ([0-9]{2}\.[0-9]{2}\.[0-9]{4});
Replace with: \n\0
-
arkaden
- Posts: 4
- Joined: Mon Dec 03, 2007 12:35 pm
-
ben_josephs
- Posts: 2464
- Joined: Sun Mar 02, 2003 9:22 pm
I tried my suggestion on a file containing 100 000 lines, each a copy of
11.10.2007;13:57:01,900;20,74;20,44;20,75;20,12;21,00;21,30;21,44;21,24;35,03;20,74;11.10.2007;13:57:02,000;20,74;20,44;20,75;20,12;21,00;21,30;21,44;21,24;35,03;20,74;
The size of the file is 17 000 000 bytes. My regex replacement works perfectly on it, making 200 000 replacements.
This might be an improvement:
Is there something unusual about your file after the 200th occurrence of lines like these? What happens if you repeat the search?
Regex is just an abbreviation of regular expression (often with a broader meaning than the strict mathematical one).
Posix (in this context) is just a syntax for regular expressions. It differs from TextPad's default. See TextPad's help under How to... | Find and Replace Text | Use Regular Expressions.
A spurious space is one not in the original (that is, my suggested regex); it shouldn't be there.
The backslashes quote the dots. A backslashed dot is literal and matches only a dot, rather than any character. See TextPad's help under Reference Information | Regular Expressions and How to... | Find and Replace Text | Use Regular Expressions.
11.10.2007;13:57:01,900;20,74;20,44;20,75;20,12;21,00;21,30;21,44;21,24;35,03;20,74;11.10.2007;13:57:02,000;20,74;20,44;20,75;20,12;21,00;21,30;21,44;21,24;35,03;20,74;
The size of the file is 17 000 000 bytes. My regex replacement works perfectly on it, making 200 000 replacements.
This might be an improvement:
It only makes 100 000 replacements.Find what: ;(([0-9]{2}\.[0-9]{2}\.[0-9]{4}))
Replace with: ;\n\1
Is there something unusual about your file after the 200th occurrence of lines like these? What happens if you repeat the search?
Regex is just an abbreviation of regular expression (often with a broader meaning than the strict mathematical one).
Posix (in this context) is just a syntax for regular expressions. It differs from TextPad's default. See TextPad's help under How to... | Find and Replace Text | Use Regular Expressions.
A spurious space is one not in the original (that is, my suggested regex); it shouldn't be there.
The backslashes quote the dots. A backslashed dot is literal and matches only a dot, rather than any character. See TextPad's help under Reference Information | Regular Expressions and How to... | Find and Replace Text | Use Regular Expressions.