我用\A.*$\r\n
删除文本中的第一行,使用Powergrep, 有没有办法让这个命令相乘?需要选择和删除文本中的前3行,并在文本中保留3行?正则表达式来替换第一行和最后一行?
试过这个解决方案Perl/regex to remove first 3 lines and last 3 lines of a string但它不能在Powergrep中工作。
我用\A.*$\r\n
删除文本中的第一行,使用Powergrep, 有没有办法让这个命令相乘?需要选择和删除文本中的前3行,并在文本中保留3行?正则表达式来替换第一行和最后一行?
试过这个解决方案Perl/regex to remove first 3 lines and last 3 lines of a string但它不能在Powergrep中工作。
您不能使用grep。 grep(1)作品行相等保证。你有一个更好的解决方案的sed(1)在下面的代码:
sed -e '1d;$d' file.txt >output.txt
我要删除线1-3
和($-3)-$
尝试
sed -e '1,3d;$-3,$d' file.txt >output.txt
对不起,我从来没有使用powergrep所以我不能以这种方式帮助你。
我在Powergrep测试过,我确认这一个工作,第一个答案没有,谢谢你的帮助。 – Jim8645