Mac Forums

Mac Forums (http://www.mac-forums.com/forums/)
-   OS X - Apps and Games (http://www.mac-forums.com/forums/os-x-apps-games/)
-   -   grep in Word X? (http://www.mac-forums.com/forums/os-x-apps-games/21484-grep-word-x.html)

Littleweseth 07-15-2005 07:25 AM

grep in Word X?
 
Is there a way to get grep in Word X? What i'm trying to do is reformat word-wrapped text (think 80-char fixed width... -ish) to take out all the returns, EXCEPT the ones that occur immediately after other returns - i.e. the ones that separate paragraphs - and replace them with spaces. With the inbuilt Replace tool, i can search ^r(return char), and do the appropriate replace, but not exclude the returns immediately after other returns.

Code:

So, as an example, i'm trying to turn :

I have a large
collection of
seashells and other things.

This is very
kewlish and leet
and haxorish
and cubic.

into :

I have a large collection of seashells and other things.

This is very kewlish and leet and haxorish and cubic.

but word only lets me do :

I have a large collection of seashells and other things. This is very kewlish and leet and haxorish and cubic.

Personally, i'm not that fond of huge run-on paragraphs that go on for a 170 pages - or so. Working with large quantities of text is fun, verr-ah fun.

If anyone's curious about why I'm trying to do this, ironically enough it's so i can print out the grep reference from the textwrangler help file while using a minimum of paper - hence the reason i'm trying to cut all the whitespace. I'm trying to copy/paste it into word - which does kill all the tables (grr!) and mangles the formatting, whether i copy it from acrobat or help viewer. I need to keep the formatting, though, hence the reason i don't just plug it into something that has grep.

(maybe i should just print the **** PDF and forget about the 7 excess pages - but nerds nevarrr give up!)

rman 07-15-2005 08:42 AM

You will not be able to use a unix command inside of word X. Have you tried editting the file using textedit or vi?

Littleweseth 07-15-2005 09:22 AM

never used vi - i grew up on windows (i'm actually 15 now, so when i started on computers in 94 or so it was DOS 6 or so + WIN3.1). Still, vim looks like it has a fairly nice help feature, though for someone who's never used it it seems a bit counterintuitive - but i digress. (why hjkl instead of arrow keys? are you telling me they had 0 arrow keys in the 70's?)

textedit has the same problems as word - no regular expressions (as far as i can tell). I can't use any other text-editing programs because i'll them lose the formatting - and besides, with the special control chars and stuff, the line-break not followed by another line-break pattern i'm looking for don't exist anymore.

rman 07-15-2005 10:48 AM

Since you called out grep, I assumed you worked with vi. When unix was created, I don't believe there were arrow keys.

Littleweseth 07-15-2005 10:52 PM

ah - i believe historians will now have to create a new period in human history : The Dark Ages Before Arrow Keys. What an 'orrible, 'orrible time that was, me boy-o....

Ah well, i'll just stay up for a few hours and do it the manual way :D


All times are GMT -4. The time now is 04:53 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.