Find and Replace Inside a Text File referring to the file name - search

What's the simplest way to do a find and replace for a given input string from filename,
Example:
filename is
abc.txt
Find inside text file:
Name = "xyz",
Nametitle = "xyz",
and replace to:
Name = "abc",
Nametitle = "abc",
What the easiest way to achieve my goal?
Can i use notepad++?

I see this is your first question on stackoverflow. Perhaps you are new to programming? But your question isn't really a programming question. But that is ok.
Sure, use notepad++: open the options for search and replace.
Add in the word you want to find, and the word you want to replace it with.
Do this for each word you want to replace.
Be sure to check the option to make it search for only the entire word: Otherwise your xyz could also match xyzFoo. And you might not want to replace it with abcFoo.
Also look for the option to search with case sensitivity (based on your preferences really).
Notepad++ is a fine editor if you are on windows. On a mac there are a myriad other options.

Related

Is there any way to copy few characters to clipboard in textpad?

I'm trying to replace a few character word in one place with the word searched in another. I.e
VARIABLE INT005 SOME TEXT BETWEEN NAME=INT020;
I want the program To copy whats after VARIABLE (INT005 in this case) and paste it after NAME=(here should be again INT005 replaced into the place of INT020)
A regex replacement should work here. Assuming you are only looking to make these replacements on a single line, you may try the following find and replace:
Find: \bVARIABLE (\S+)(.*?)\bNAME=\S+;
Replace: VARIABLE $1$2NAME=$1
Demo
Edit:
If your text could span multiple lines, then either turn on "dot all" mode from Textpad (not sure where you would do that), or use this find version:
\bVARIABLE (\S+)([\s\S]*?)\bNAME=\S+;

Complex find and replace in notepad++

I'm trying to do a find and replace in notepad++ where i remove the dashes from a set of numbers and letters formatted as following: aa-aaa-nn-nnnnn
I've considered writing a plugin, but it just seems like too much work to be worth it.
Here's an example of what I have and what I need.
I have this: <ISRC>AB-CED-12-34567</ISRC>
And the result should be: <ISRC>ABCED1234567</ISRC>
I've tried finding (A-Z+)-(A-Z+)-(\d+)-(\d+) and replacing this with \1\2\3\4
but then it can't find the "text". If I knew how to write the darned search codes, I could do this myself, but I just can't find a complete guide anywhere.
You're close, you want to use character class:
Ctrl+H
Find what: ([A-Z]+)-([A-Z]+)-(\d+)-(\d+)
Replace with: $1$2$3$4
Replace all
[A-]+ means one or more uppercase letter, if you want to match also lowercase, use [A-Za-z]+

Find & replace code across all files in a folder in Linux

I have been using Notepad++ for Windows when I want to find a certain text across all files in a given folder. This was extremely useful for debugging my MatLab code because one project entails tens of MatLab files.
I could also replace all texts into another across all files in a folder.
I could also replace things like /r/n which means line replacement.
Now I must need to work on a Linux server. Notepad++ couldn't be installed on the university server I am allotted to. And as far as I tried, Sublime Text couldn't find and replace things like /r/n
What option do I have on Linux?
Sublime Text supports replacement of line breaks, but you have to select "regular expression" (Alt+R) and you have to enter the line break correctly (\n, not /r).
The most useful method if find and replace. (Ctrl+H)
However, another possibility is the multiple selection as in the example number one of the official website: https://www.sublimetext.com/
How it works:
You select the word you want to replace, press Ctrl+D (which will select the same word with the same name). Continue pressing Ctrl+D until you selected every word you want to replace.
Once it is done, you will have a multiple selection, which means that every character will be write at each word selected position.
I invite you to check the example on their website, it is a very good illustration.
You can use Kate, it is fine replacement for Notepad++.
Kate "Search and Replace" feature is very powerful.

How can I remove alphabet numeric character in notepad file

I am having a text file
Example:
793643450715275|Andriod Game Hacker
470734673064253|Andriod Firmရာ
382409221961101|Andriod Solution
709215912481252|AndriodوIOS
248027618719895|Exchange App Andriod Reviews
212241765574268|andrioders
I want to remove all alphabet characters
Example Like :
793643450715275
470734673064253
382409221961101
709215912481252
248027618719895
212241765574268
Anybody tell me how can I do this .I have also try notepad++ but not able to do this
Suggest Me.
In Notepad++, please try Find what :
\D+
Replace with :
\r
in Regular expression Search Mode, Replace All.
In Word:
Find what:
|*^13
Replace with:
^p
check Use wildcards and Replace All.
In Excel:
=LEFT(A1,FIND("|",A1)-1)
or if number format preferred:
=1*LEFT(A1,FIND("|",A1)-1)
and in both cases copy down to suit.
Or Text to Columns with pipe as the delimiter and delete what is not required.

Notepad++ Search Multiple and Replace Respectively

Doing some String manipulation and I want to ask if the below is possible in Notepad++:
I have a string with Years:
10-Jan-13
22-Feb-14
10-Jan-13
10-Mar-13
I want
10-JAN-13
22-FEB-14
10-JAN-13
10-MAR-13
(There's more data on each line there but I am just showing a simplified example).
I know I can OR search with | character so find, JAN|FEB|MAR... but how do I replace according to what's found.
(Just trying to save some time)
Thanks.
Not sure if it's a plugin or built-in, but you can use the TextFX Characters plugin, to select the text, and then in the textfx characters dropdown, click UPPER CASE.
Update
Looks like it is a plugin:
TextFX menu is missing in Notepad++
Multiple Files
I found this site which gives a way to convert text to uppercase with regular expressions: http://vim.wikia.com/wiki/Changing_case_with_regular_expressions
So, what you can do is bring up the find in files dialog (CTRL+SHIFT+F), change search mode to Regular Expression, and then use something like this:
Find: (\d{2}-\w{3}-\d{2})
Replace with: \U\1
Directory: Whichever directory your files are in (and only the files you want changed).
\U is an uppercase flag, and the brackets in the Find regex correspond with the \1 backreference, which will basically replace it with itself (but uppercase).

Resources