小编jul*_*ert的帖子

OS X使用正则表达式数字在bash中查找\ d不会产生预期结果

我在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)

但这似乎有点长啰嗦.

regex macos bash terminal find

9
推荐指数
1
解决办法
8845
查看次数

在bash中匹配前后删除行(使用sed或awk)?

我试图从一个充满交易的文件中删除模式匹配两侧的两行.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行数据.

shell awk sed

7
推荐指数
3
解决办法
1万
查看次数

Pydrive后端不使用duplicicty - python

我正在尝试使用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)

python duplicity

1
推荐指数
1
解决办法
2689
查看次数

标签 统计

awk ×1

bash ×1

duplicity ×1

find ×1

macos ×1

python ×1

regex ×1

sed ×1

shell ×1

terminal ×1