Delete everything after a number of characters in string in Notepad++
2014-04
The following is an example of characters per line in Notepad ++. I need to limit the characters per line to 14 characters.
11111111111111111111
222222222222222222222222222
33333333333333333333333
I need it to look like the following:
11111111111111
22222222222222
33333333333333
How can I can limit the number of characters to 14 characters per line in Notepad++
Do a Regex replace.
Replace ^(.{14}).*$
with \1
. Keep the . matches newline
option unchecked.
In notepad++ you can use the find and replace function like this :
I have a log file and I need to remove the first 27 characters off every line. You would have a line like this:
2011-09-25 01:25:29 [INFO] <Exazoro> wazup
But it needs to be like this:
<Exazoro> wazup
Use regular expression search, search for ^...........................
and replace with (empty string).
Unfortunately, Notepad++ does not support repetition counts like ^.{27}
— the SciTE regexp documentation applies here as well.
Alternatively, use rectangular multi-line selection (press Alt
while selecting) to select these first 27 characters in every line, then press Delete
or Backspace
.
Using Unix tools (e.g. Cygwin, UnxUtils) you can use cut -c28-
or sed -E "s|^.{27}||"
instead. At least, these are the Linux command line calls you'd use...
Below is the macro way. This is more intuitive for non-technical people:
1) Place cursor on the first line (any cursor position)
2) Click : Macro -> Start Recording
3) Do the following key press activities:
* Press the Home key
* Press Delete key 27 times (till you reach the intended character)
* Press down arrow button.
4) Click : Macro -> Stop Recording
5) Click : Run Macro Multiple times -> select Run until the end of file -> click Run.