grep in Word X?

L

Littleweseth

Guest
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


Retired Staff
Joined
Dec 24, 2002
Messages
12,637
Reaction score
168
Points
63
Location
Los Angeles, California
Your Mac's Specs
14in MacBook Pro M1 Max 32GB 2TB
You will not be able to use a unix command inside of word X. Have you tried editting the file using textedit or vi?
 
OP
L

Littleweseth

Guest
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


Retired Staff
Joined
Dec 24, 2002
Messages
12,637
Reaction score
168
Points
63
Location
Los Angeles, California
Your Mac's Specs
14in MacBook Pro M1 Max 32GB 2TB
Since you called out grep, I assumed you worked with vi. When unix was created, I don't believe there were arrow keys.
 
OP
L

Littleweseth

Guest
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
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top