Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Paste and Match Style System
If you use an editor which does not have a "Paste and Match style" option, and you want to copy/paste a fragment of web page or other rich text without all the formatting, use the following script:

pbpaste | pbcopy<br>
Save the script as, for example,
(as hinted here), change the permissions with
chmod a+x poortextformat.command
and that's it. This hint is useful for example in Google Docs, as there is no option to paste plain text.
  • Currently 3.75 / 5
  You rated: 4 / 5 (4 votes cast)

Paste and Match Style | 7 comments | Create New Account
Click here to return to the 'Paste and Match Style' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Paste and Match Style
Authored by: hamarkus on Oct 04, '07 07:56:56AM
Just a month ago there was a similar hint with links to even older similar hints:

As I said there in the comments, I've been a happy camper for quite some time now with:
I launch it via a keyboard shortcut (cmd-alt-shift-P in my case).

It always worked for me, never had problems with it.

[ Reply to This | # ]
Paste and Match Style
Authored by: TGV on Oct 04, '07 08:06:42AM

I'm afraid you can't rely on this. Somewhere the documentation says that pbcopy and pbpaste cannot be used in parallel. Of course, if your clipboard stays under the buffer size (8K?, 32K?), then you're probably safe, since pbpaste might have output the clipboard before pbcopy has seen a single byte, but beware that this does not work by design.

[ Reply to This | # ]
Paste and Match Style
Authored by: eno on Oct 04, '07 08:11:28AM

Well, just redirect the output to a temporary file then and read it back in.

[ Reply to This | # ]
Paste and Match Style
Authored by: googoo on Oct 04, '07 08:23:53AM
It looks like there is a formatting problem in the hint. The <br>s should not be in the script.


[ Reply to This | # ]
Paste and Match Style
Authored by: ctierney on Oct 04, '07 09:38:14AM
Here's an AppleScript version:
set the clipboard to «class ktxt» of ((the clipboard as text) as record)
-- Cole

[ Reply to This | # ]
Paste and Match Style
Authored by: spiff on Oct 04, '07 04:29:01PM

A fairly simple and fast approach involves keeping TextEdit open.

Open up TextEdit (Applications:TextEdit) and then put it in 'text mode' only (cmd-shift-T)

take the formatted text you want, paste it (cmd-v) into text edit and all the formatting is wiped. Without clicking a button, do cmd-c and you've got text free of bold/italic/font-size etc. and it's now just pure text.

no applet needed, just a mouse-click/cmd-tab to TextEdit, paste/copy, cmd-tab back to the app/web site/whatnot.

[ Reply to This | # ]
Paste and Match Style
Authored by: wayneDL on Oct 07, '07 01:02:26PM

now this is a great tip--using applescript and apple events instead of pbcopy | pbpaste will probably avoid the buffer problem mentioned in another comment. thanks.

[ Reply to This | # ]