Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Whenever you try to copy an HTML table to the pasteboard, it will select by row. Sometimes, I'd like to select by columns. Is there a way to do this? If not out of the box, any extensions that enable this kind of functionality.

share|improve this question

1 Answer 1

As far as I know, there's no way to do that in Safari or Chrome, but in Firefox you can select ranges of cells by holding option and command.

You could also copy the whole table and paste it to a spreadsheet application or use something like pbpaste | cut -d $'\t' -f3. But it might not work if there are cells that contain br elements or rows that start with empty cells.

I've had to use something like this with a few tables that contained br elements:

ruby -e '`pbpaste`.scan(/<tr>.*?<\/tr>/m).each { |r| puts r.scan(/<td>(.*?)<\/td>/m)[2] }'
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.