On Saturday, August 5, 2006, at 03:27 pm, David Livesay wrote:
On Aug 5, 2006, at 10:19 AM, David Livesay wrote:
On Aug 5, 2006, at 9:26 AM, Andrew Brown wrote:
I have a file like this
1 line...
line...
line...
2 line...
line...
line...
3 line...
and I would like to achieve this
1 line...
1 line...
1 line...
2 line...
2 line...
2 line...
3 line...
A simple job in Excel, but Excel screws up text given any chance it
gets and some of the lines are long. There is a tab after the
numbers and one at the start of every line without a number.
Any ideas? I can't write Perl.
I would never ask anyone to write Perl. You can do this with
Find/Replace using regular expressions, which are bad enough. ;-)
Search for: (\d+)(\t)(.+\r)(\t)(.+\r)(\t)(.+\r)
Replace with: \1\2\3\1\4\5\1\6\7
Make sure "Use Grep" is checked.
If it doesn't work I may need to see part of the actual file. This
worked on your example.
Actually, this can be simplified a little:
Search for: (\d+)(\t.+\r)(\t.+\r)(\t.+\r)
Replace with: \1\2\1\3\1\4
a reoccurring problem i find with regex is a seeming
deficiency/inability to deal with varying number of things. what
happens if the requirement given was:
1 line...
line...
2 line...
3 line...
line...
line...
line...
line...
4 line...
line...
to:
1 line...
1 line...
2 line...
3 line...
3 line...
3 line...
3 line...
3 line...
4 line...
4 line...
is that doable with regex? that sort of thing often stumps me.
thanks, ben.
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <[EMAIL PROTECTED]>