Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keep only the first 8 characters in a line in notepad++

I'm having troubles on keeping the first 8 characters in Notepad++.

I have a list like this :

johndoe2.21test
markdoetesting.new
marvin213.jo.hn
abcd1234.dcba

And I want a output like this:

johndoe2
markdoet
marvin21
abcd1234

Can you point me in the right direction ?

like image 495
user2782184 Avatar asked Oct 16 '13 07:10

user2782184


People also ask

How do you remove the last 3 characters in notepad?

Use find and replace, check the extended option, look for :\r\n and replace with \r\n . This will remove them all except for the last line.

How do you remove the first 6 characters in Notepad++?

Use regular expression search, search for ^........................... and replace with (empty string). Alternatively, use rectangular multi-line selection (press Alt while selecting) to select these first 27 characters in every line, then press Delete or Backspace .

How do I change the start of a line in notepad?

Press Ctrl+F to open Find window, click on the Replace tab, check that you have selected Regular Expression option, now add ^ in the Find textbox and the text you want at the start of each line in the Replace textbox, and click Replace all.


1 Answers

You could use the column select feature for this.

  • Use Alt + Shift + Arrow keys to select only the first eight characters.
  • Once you select, copy it and paste it elsewhere.

You can also use Find and Replace in Regular Expression mode.

  • Use Find/Replace feature.
  • Select Regex Search Mode.
  • In Find box enter this ^(.{8}).*
  • In Replace box enter this \1
  • Click on Replace All.
like image 110
Noel Avatar answered Oct 02 '22 00:10

Noel