如何使用 Notepad++ 删除每行的最后 13 个(或 n 个)字符 [英] How to remove the last 13 (or n) characters of every line using Notepad++
问题描述
我有一个文件,每行都以 Mar 15, 2013
和其他日期结尾,所以我需要删除每行的末尾,比如最后 13 个字符
I have a file which each line that ends with Mar 15, 2013
and other dates so I need to remove the end of each line say the last 13 characters
每行都有不同的长度和不同的字符,所以不能使用任何东西作为分隔符.
Each line is a different length and has different characters so cant use anything as delimiters.
推荐答案
您可以在 search and replace
-dialog (Ctrl
+H
) 即锚定到行尾:
You can use a regular expression in the search and replace
-dialog (Ctrl
+H
) that is anchored to the end of the line:
.{13}$
然后用空替换它.当然,您可以使用更具表现力的正则表达式来仅匹配特定格式的日期,而不匹配其他任何内容.
Then replace it with nothing. And of course you could use a more expressive regex to match only dates in your particular format and nothing else.
这篇关于如何使用 Notepad++ 删除每行的最后 13 个(或 n 个)字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!