我在OS X终端中使用以下regex find命令来查找整个加载的文件,这些文件具有8位数的文件名,后跟.jpg,.gif,.png或.eps扩展名.即使我告诉OS X/BSD发现使用现代正则表达式,下面也没有结果
find -E ./ -iregex '\d{8}'
Run Code Online (Sandbox Code Playgroud)
使用http://rubular.com/(http://rubular.com/r/YMz3J8Qlgh)显示正则表达式模式产生预期结果,OS X在输入时产生结果
find . -iname '[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9].*'
Run Code Online (Sandbox Code Playgroud)
但这似乎有点长啰嗦.
我试图从一个充满交易的文件中删除模式匹配两侧的两行.IE浏览器.找到匹配然后删除它之前的两行,然后删除它后面的两行,然后删除匹配.将此写回原始文件.
所以输入数据是
D28/10/2011
T-3.48
PINITIAL BALANCE
M
^
Run Code Online (Sandbox Code Playgroud)
我的模式是
sed -i '/PINITIAL BALANCE/,+2d' test.txt
Run Code Online (Sandbox Code Playgroud)
但是,这只是在模式匹配后删除两行,然后删除模式匹配.我无法使用sed以任何逻辑方式从原始文件中删除所有5行数据.
我正在尝试使用PyDrive的duply/duplicity.但是我一直收到一条非常神秘的错误消息,告诉我参考PyDrive安装联机帮助页.哪个没提供解决方案.
这是我正在运行的duply命令的输出,包括错误.
$ duply mac-mini.gdrive status
Start duply v1.11.1, time is 2016-02-20 19:28:59.
Using profile '/etc/duply/mac-mini.gdrive'.
Using installed duplicity version 0.7.06, python 2.7.10, gpg 1.4.19 (Home: ~/.gnupg), awk 'awk version 20070501', grep 'grep (BSD grep) 2.5.1-FreeBSD', bash '4.3.42(1)-release (x86_64-apple-darwin14.5.0)'.
Checking TEMP_DIR '/tmp' is a folder and writable (OK)
Test - En/Decryption skipped. (GPG disabled)
--- Start running command STATUS at 19:29:00.000 ---
BackendException: PyDrive backend requires PyDrive installationPlease read the manpage to fix.
19:29:00.000 Task 'STATUS' failed with exit code …Run Code Online (Sandbox Code Playgroud)