0

I have a bunch of files that I have in line 7(using notepad++) this:

name: word

And I want to replace that word with the filename without the file extension .yml (the filename have just the dot from the extension, example: filename.yml), so when replaced it looks like this:

name: filename

Can anyone help me since I have no knowledge with find/replace variables on notepad++?

Examples:

name: tower
name: house
name: building
name: marcus
name: john
  • 1
    Post an example of your data from line 7 or whatever. – hwnd Nov 07 '13 at 15:59
  • 1
    regex in notepad++ can't "fetch" data from filenames, http, ftp or any other sources. You will need to hardcode it in the replace input. Otherwise you;ll need to create your own plugin. – HamZa Nov 07 '13 at 16:03
  • is there anyway to be done in an easy way? other than notepad++? –  Nov 07 '13 at 16:07
  • 1
    @JPDayz Being a developer ain't easy. You can do it in almost anylanguage that has the ability to open/edit files. Also what have you tried ? – HamZa Nov 07 '13 at 16:10
  • I tried nothing because i have no clue how to do it... i have no programming knowledge. –  Nov 07 '13 at 16:14
  • 2
    You could use command line tools like [sed](http://en.wikipedia.org/wiki/Sed). Since you are a Windows user, check this [list](http://stackoverflow.com/a/127567/2140859) of packages. Otherwise search google for any user-friendly Windows software being able to make such operations, I guess you will be able to find something without spending too much time learning regular expressions. Or you could see that as a good opportunity to learn a programming language (it's a rewarding experience after all!). If you sacrifice a whole day reading a Python tutorial for example, you could make it! – psxls Nov 07 '13 at 16:52

1 Answers1

2

You can achieve this relatively simply by AutoHotKey. It allows you sending keystrokes/mouseclicks etc. so you can quickly perform actions which are else done manually. In this case, you can automate these manual steps by sending appropriate keypresses in Notepad++. Please learn how to do the following using keyboard and then simply send those keys via AHK.

  1. menu Edit > Copy to Clipboard > Current Filename to Clipboard (F10, then arrows)
  2. Open Find/Replace dialog (Ctrl+H)
  3. Find what: type filename
  4. Replace with: send ctrl+V (paste) into this field so filename from clipboard gets pasted
  5. send 4 backspaces to delete file extension and dot (if your extension has 3 characters)
  6. press Replace All button (Alt+A)

Please see this answer for some details of AutoHotKey use with Notepad++.

Community
  • 1
  • 1
miroxlav
  • 11,796
  • 5
  • 58
  • 99