Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Let's say I have a list of items like so:


and I want to change it to the following:

'default'   => t('default'),
'cube'      => t('cube'),
'page'      => t('page'),
'concave'   => t('concave'),
'zoom'      => t('zoom'),
'linear'    => t('linear'),
'fade'      => t('fade'),
'none'      => t('none'),

Are there any GUI based projects that could let me do this. I know the Mac has Grep Built in and there is also Text Wrangler that allows for GREP, but I find that these are too complicated (especially for short simple lists). Are there any GUI solutions?

share|improve this question
Well, you could force Numbers, Excel or OpenOffice into doing these kind of things. But using Terminal and see/awk (or even a simple for loop with echo) would be much easier to solve this particular problem. What exactly are you trying to do here (and why)? – patrix Jan 31 '13 at 19:14
up vote 2 down vote accepted

The Unix shell is probably the best text list transformation software.

$ sed "s/^/'/;s/$/'/" <<< cube | awk '{printf "%-12s=> t(%s),\n",$1,$1}'
'cube'   => t('cube'),
$ sed -E "s/(.*)/'\\1' => t('\\1'),/" <<< cube | column -t
'cube'  =>  t('cube'),

Or write throwaway scripts in some scripting language:

puts "cube
page".gsub(/^.*/) { "'#{$&}'".ljust(11) + " => '#{$&}'," }

Even if there were GUI applications for tasks like this, it would probably be more useful to learn (or get faster at using) scripting languages or text editors.

share|improve this answer

Your Answer


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.