1. Select all of the last names by holding down the command key (control key in Windows) and double-clicking or click-and-dragging on each of them.
  2. Once they’re all selected, you can press command-x to cut, just like you normally would.
  3. Then you can select all of the first names, and press command-shift-L to select them as individual lines.
  4. Once they’re selected, press the right arrow key to go to the end of each line, press space, and press command-v to paste last names in.

Rearrange with ease

Now you have the names together,  but they’re formatted to have the first name first, and you want it the other way around. No problem:

  1. You can select all of the last names by holding down the command key (control key in Windows) and double-clicking or click-and-dragging on each of them.
  2. Once they’re all selected, you can press command-x to cut, just like you normally would.
  3. Then you can select all of the first names, and press command-shift-L to select them as individual lines.
  4. Once they’re selected, just press the left arrow key to go to the front of the line, and press command-v to paste the first names back in.
  5. You should see cursors on each line now, and they should all be blinking at the end of the first names. Anything you type now will show up on each of those lines. So if you type a comma and a space, you’re all set.

Prepend text to a list

Maybe you want to formalize things a bit and add a title to the beginning of each name. With a text editor, you can add them all at once:

  1. Hold the command key (control key in Windows) and click at the beginning of each line you want to prepend text to.
  2. Once all of the lines are selected, you can start typing.

Remove text from multiple lines at once

Eh, maybe the titles are too formal. So let’s remove them:

  1. Select the entire list.
  2. Press command-shift-L to select each item individually. (Control-shift-L in Windows.)
  3. Press the left arrow key to go to the beginning of the line.
  4. Hold the shift key, and press the right arrow until you get to the beginning of the first names. Then press delete.

Obviously, this works best when you’re lucky enough to have a list where the items you want to delete all have the same number of characters.

Append text to a list

The same way we can prepend text to the beginning of a list, we can also append text to the end:

  1. Select the entire list.
  2. Press command-shift-L to select each item individually. (Control-shift-L in Windows.)
  3. Press the right arrow key to go to the end of the line.
  4. Start typing.

Bonus: Now that you have your guest list nicely formatted, why not put it in some kind of order. The programmers in question–both living and dead–would probably like that. In most text editors, you can sort a list alphabetically by selecting the text and pressing F5. All that’s left to do now, if you want all of the guests on your list to come to your party, is to invent a time machine.

📬 Sign up for the Daily Brief

Our free, fast, and fun briefing on the global economy, delivered every weekday morning.