使用Linux命令从完整路径复制postgres路径

时间:2018-06-23 08:04:56

标签: postgresql path copy quotes double-quotes

我试图从完整路径中获取路径并将其复制到新的列中,但是我很难管理引号。  我有一列带有“ / volume2 / test /这里是/ my file.avi”,我想在另一列中复制“ my file.avi” (我也想要这条路径,但我会在之后检查) 有人可以帮忙吗?

/usr/bin/psql -U postgres video_metadata -q -A -t -c \"""SELECT RIGHT(path, POSITION('\' in REVERSE(path)) -1 ) from video_file;""\""

但是我有这个错误

syntax error near unexpected token `('

如果我尝试更清洁的东西

/usr/bin/psql -U postgres video_metadata -q -A -t -c "SELECT RIGHT(path, POSITION('\' in REVERSE(path)) -1 ) from video_file;"

我有这个错误

ERROR:  unterminated quoted string at or near "'\' in REVERSE(path)) -1 ) from video_file;"
LINE 1: SELECT RIGHT(path, POSITION('\' in REVERSE(path)) -1 ) from ...

2 个答案:

答案 0 :(得分:0)

我想你是说这个意思

120 public function put($path, $contents, $lock = false)
121    {
122        return file_put_contents($path, $contents, $lock ? LOCK_EX : 0);
123    } 

答案 1 :(得分:0)

发现....我与Windows路径混在一起.....应该是'/'而不是'\'

完整命令为:

 E/Twitter: Invalid json: <?xml version="1.0" encoding="UTF-8"?><errors><error code="415">Callback URL not approved for this client application. Approved callback URLs can be adjusted in your application settings</error></errors>
        com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
            at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:224)