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
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...
^[0-9\-]+ [0-9:]+ \[[A-Z]+\]
Sep 25, 2011 at 12:46
Since Daniel Beck's answer was originally posted, updates to Notepad++ now support the following regular expression repetition: ^.{27}
But note with just that expression, Notepad++ will repeatedly remove all characters from the document until no more than 27 remain. To avoid this you can use the following Find/Replace:
^.{27}(.*)$
$1
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.
a small improvement to Daniel Beck answer:
Use regular expression search, search for:
^...........................(.*.\r\n)
and replace with:
\1
ALT + SHIFT + Mouse selection (only ALT is not working)
Point at the beginning of the file, go to the end hold ALT+SHIFT and point on the position u want to...
Sometimes its removing the pattern after starting character as well, & when macro isn't a solution, alt+shift+right drag drop is also not possible because of large data for which someone need to work then below might work.
I have the error file in format of
[19 Aug 2022 00:00:00:021] ERROR TaskUtils$LoggingErrorHandler::handleError:95 - Unexpected error occurred in scheduled task.
For which need to remove [19 Aug 2022 00:00:00:021] for which simple but effective solution I used,
Hope some one get this useful. By this I was able to remove all leading unwanted logging character for large file.