I have a list of data to which I need to put a '
symbol at the start of the line and at the end of the line. So the original data looks like this:
abcde cdeab deabc eabcd
And I want all of the lines to look like this:
'abcde' 'cdeab' 'deabc' 'eabcd'
In my real data, I would have 10,000 of lines. So if I can do something like Ctrl+Shift+A to select the entire document and then have some magic shortcut to change from selecting all lines to editing all lines that would be perfect!
Select the lines you want and then press: Windows: Shift + Alt + i. Mac: shift + option + i.
If you want to select multiple lines / edit multiple lines in non aligned blocks you need to press Ctrl+Alt and explicitly click where you want each cursor to be and then just start typing as in example 2 below.
Expand the Search widget to display the Replace text box. When you type text into the Replace text box, you will see a diff display of the pending changes. You can replace across all files from the Replace text box, replace all in one file or replace a single change.
Solution. Open the desired file and press CTRL + A to select all lines.
You could edit and replace with a regex:
Find (Ctrl+F):
^(.+)$
Replace:
'$1'
This regex finds any content on a line and wraps it inside quotes. The $1
refers to whatever is matched inside the parentheses in the regex. In this case, it's "one or more characters" i.e. everything on the line. Be sure to tick the regex icon.
If every line may or may not have a space before the content, and you want every line to have a space, try this:
Find:
^ ?(.+)$
Replace (notice the space before the first quote):
'$1'
Here is an easy way to do this:
Ctrl+A to select all or select your desired text.
Shift+Alt+I to put a cursor at the end of each line.
Type your ' (or whatever you want at the end).
Home will move all your cursors to the beginning of the lines.
Type your ' (or whatever you want at the beginning of all the lines).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With