How to add asterisk to a list of filenames and make it a line
-
Hello.
I’ve a list of file names (about 4000).
For example:
A-67569
H-67985
J-87657
K-85897
.
.
.I need to put asterisk before and after each file name. And make it a line format.
Example:
A-67569 H-67985 J-87657 K-85897 …
Note that there is a space between filenames.
How can I do it?
Please advise.
Thanks
-
After I posted, I noticed it’s not allowing to show the asterisks I put before and after the filenames. So please look at the pic in the link.
Thanks
-
Hello @sunil-kumar and All,
Not difficult with regular expressions ! So :
- Open the Replace dialog (
Ctrl + H)
SEARCH
(?-s)(.+)\RREPLACE
*\1*\x20-
Select the
Regular expressionsearch mode -
Move your cursor to the beginning of your list of files
-
Click several times on the
Replacebutton or once, only, on theReplace Allbutton
Voilà !
Notes :
-
As usual, the
(?-s)modifier means that the regex dot character (.) represents a single standard character -
Then, the part
(.+)stands for any non-empty range of consecutive standard characters, which is stored as group1, as embedded in parentheses -
The last part,
\Rmatches any kind of line-break (\r\n,\nor\r) -
In replacement, we rewrite an asterisk, followed by the filename ( group
1), followed, again, with an asterisk and, finally, with a space character (\x20)
Best Regards,
guy038
P.S. :
A small drawback is that the last file, of the unique line, is, of course, followed with a space char, too !
- Open the Replace dialog (
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login