lumaflux <[email protected]> sez:

>I have documents that I need to remove the white space between the first
>and second line and add a comma. For example before:
>
>1.     ¿Qué vas a comprar?
>2.     What are you going to buy?
[...]
>
>After:
>
>1.     ¿Qué vas a comprar?,What are you going to buy?
[...]
>
>What would be the best way to do this in BBedit (Applescript)?
>I'm sure it's simple, but I can't get a hold on it.


Although you could use an AppleScript to do this, I suggest you instead
perform a search & replace (or Replace All) using the "Grep" option and
appropriate grep patterns.

For example, here's one way to do this:

Find:     ^(.+?)\r(.+?)$

Replace:  \1,\2

In the Find pattern, use ^ to start matching at the beginning of a line, then
.+? to do a non-greedy match of the entire first line, and wrap that in
parentheses (.+?) to make it a reusable subpattern. Next, use \r to match
the line break between the first and second lines, then (.+?) again to
match the second line, and $ to stop the match at the end of the second
line.

The Replace pattern will replace the entire match (both lines) with the
contents of the first line \1 then the literal comma "," you wish to add,
and finally the contents of the second line \2.


[For more info about using grep patterns -- also known as regular
expressions -- plus various examples, please see Chapter 8 of BBEdit's PDF
manual, which you can open at any time by choosing Help -> User Manual.]


Regards,

 Patrick Woolsey
==
Bare Bones Software, Inc.                      <http://www.barebones.com>
P.O. Box 1048, Bedford, MA 01730-1048

-- 
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.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>

Reply via email to