BBEdit文本筛选器-按1递增值

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了BBEdit文本筛选器-按1递增值相关的知识,希望对你有一定的参考价值。

Text filter to increment numbers by one with regex in BBEdit (Mac only)
  1. #!/usr/bin/perl -w
  2.  
  3. # 1. Copy this to a new file in BBEdit (bottom bar of the file window)
  4. # 2. Choose Unix (LF) for line endings
  5. # 3. Save it to ~/Library/Application Support/BBEdit/Text Filters/
  6. # 4. Relaunch BBEdit
  7. # 5. Invoke the script in "Text > apply text filter >" menu
  8. # 6. Presto!
  9.  
  10. while(<>) {
  11. my $line = $_;
  12.  
  13. # If you wish, you can personalize you regex by change the patterns...
  14. # ...between "s/" and "/ge" in the next line.
  15. # The slash in the middle divides the search and replace patterns.
  16. # The "e" part executes the replace as Perl code...
  17. # ...incrementing the value of the former number by one.
  18.  
  19. $line =~ s/(d+)/($1 + 1)/ge;
  20. print $line;
  21. }

以上是关于BBEdit文本筛选器-按1递增值的主要内容,如果未能解决你的问题,请参考以下文章

如何通过命令行实用程序操作文本:grep、cut、awk、sed 或 BBEdit(Grep 查找选项)

如何从现有排名值创建具有递增排名值的运行范围的表?

Python实现数据平滑与离群点筛选

使用Grep和BBEdit / Textwrangler复制一个set变量并将其粘贴到行中

numpy ndarray 按条件筛选数组,关联筛选

MFC的编辑框里不能按时间依次显示递增的数字