88799

Find text and Replace for filename on notepad++

Question:

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

Answer1:

You can achieve this relatively simply by <a href="http://www.autohotkey.com" rel="nofollow noreferrer">AutoHotKey</a>. 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.

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

Please see <a href="https://stackoverflow.com/questions/22220666/in-notepad-change-tab-size-instantly/22880354#22880354" rel="nofollow">this answer</a> for some details of AutoHotKey use with Notepad++.

Recommend

  • How to toggle a set of keybinds on and off?
  • A Program to simulate keyboard presses
  • Autohotkey : Clipboard Convert Tabs to Spaces
  • Getting a value from deep inside JSON
  • What is wrong with this StringReplace code?
  • Controller scaffolding doesn't work in VS 2017 preview for ASP.NET Core 2 Preview
  • create object parent which nested children in mongoose
  • counting islands in R csv
  • How to check for presence of the key of a value (as defined in one dict) in another dict, in Python?
  • Getter and Setter conventions in go lang
  • How to handle TRegEx named capture groups that might be empty?
  • How to post in Facebook with @mention ability using stream.publish?
  • Using XPath to access comments a flat hierachy
  • DS.FixtureAdapter loses fixture data with hasMany async attributes
  • Firebase database structure - need advice
  • Google reCaptcha - empty error message, not receiving response to challenge (The reCAPTCHA wasn'
  • Read multiple word strings with java.util.Scanner() [duplicate]
  • Multi-line JSON read using Apache PIG
  • Renewing Cookie-session for express.js
  • How to Cache Images Dynamically-Generated with PHP?
  • Visual basic auto imports namespaces
  • python regex split string while keeping delimiter with value
  • passing parameter to server in ExtJs
  • AutoHotKey - how to send control and same key multiple times
  • How to retrieve a specific string from a specific list from a file with JSON in Python
  • Haskell: function composition with anonymous/lambda function
  • Get current user from inside the model in Sails
  • retrieving data from url in iphone
  • EntLib Way to Bind “Null” Value to Parameter
  • Creating a Multidimensional, Associative Array in VBScript
  • Yii2: Finding file and getting path in a directory tree
  • 550 Access denied - Invalid HELO name
  • Django model inheritance, filtering models
  • WPF ICommand CanExecute(): RaiseCanExecuteChanged() or automatic handling via DispatchTimer?
  • How solve “Qt: Untested Windows version 10.0 detected!”
  • Highlight one bar in a series in highcharts?
  • Is possible to count alias result on mysql
  • Javascript Callbacks with Object constructor
  • How can I use Kendo UI with Razor?
  • Benchmarking RAM performance - UWP and C#