Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
share|improve this question
    
you could use some varient of the unix cut command from unxutils or busybox to do that much more easily - does it have to be notepad++? –  Journeyman Geek Sep 25 '11 at 10:21
    
@JourneymanGeek it dosn't have to be notepad++ its just waht i mainly use and it has macro and plugin support so i guessed there might be something to do that. –  Adam543i Sep 25 '11 at 10:24
add comment

2 Answers

up vote 24 down vote accepted

Use regular expression search, search for ^........................... and replace with (empty string).

enter image description here

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.

enter image description here


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...

share|improve this answer
9  
Alt + Shift + right to select the 27 characters in the first row, then Pg Dn whilst still holding Alt + Shift should do it –  icc97 Sep 25 '11 at 11:25
1  
For the regex, Notepad++ doesn't follow all the standard regex rules, so I'm not surprised that you couldn't get it to work. And since it looks like the first 27 characters are a date, time, and error level, a more informative regex might be possible, like ^[0-9\-]+ [0-9:]+ \[[A-Z]+\] –  MBraedley Sep 25 '11 at 12:46
1  
Loving the Alt for rectangular selection!! –  Gromer Sep 14 '12 at 21:27
    
Alt selection simple and easy. Thanks Daniel Beck. –  Uday Kiran Thummalapalli Apr 9 '13 at 17:49
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

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.