Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grep error #1035

Closed
dayhaha opened this issue Dec 29, 2016 · 1 comment · Fixed by #1036
Closed

grep error #1035

dayhaha opened this issue Dec 29, 2016 · 1 comment · Fixed by #1036

Comments

@dayhaha
Copy link
Contributor

dayhaha commented Dec 29, 2016

在demo/recommendation/evaludate.sh脚本中

function get_best_pass() {
  cat $1  | grep -Pzo 'Test .*\n.*pass-.*' | sed  -r 'N;s/Test.* cost=([0-9]+\.[0-9]+).*\n.*pass-([0-9]+)/\1 \2/g' | sort | head -n 1
}

grep -Pzo 在mac中运行出错。

➜  src git:(develop) ✗ grep -Pzo 'Test .*\n.*pass-.*' mlp_train.log
usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
	[-e pattern] [-f file] [--binary-files=value] [--color=when]
	[--context[=num]] [--directories=action] [--label] [--line-buffered]
	[--null] [pattern] [file ...]

发现原因是在ubuntu下面
grep --version
grep (GNU grep) 2.16
在mac中
grep --version
grep (BSD grep) 2.5.1-FreeBSD

而上面的参数 -P, --perl-regexp PATTERN is a Perl regular expression
似乎只在GNU grep中才有。

这里是不是需要统一一下,让其能在所有平台使用呢?

@dayhaha dayhaha added the QA label Dec 29, 2016
@dayhaha
Copy link
Contributor Author

dayhaha commented Dec 29, 2016

sed -r 在mac中bsd sed也没有,只有gnu sed有

zhhsplendid pushed a commit to zhhsplendid/Paddle that referenced this issue Sep 25, 2019
* ok

* ok

* ok

* add check_approval

* check approval

* check approval

* check approval

* check approval

* check approval

* check approval

* add check_approval

* add check_approval

* add check_approval

* add check_approval

* add check_approval

* change api

* change api
lizexu123 pushed a commit to lizexu123/Paddle that referenced this issue Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant