SED没有终止`s'命令仅在少数服务器上失败

时间:2015-05-07 21:11:03

标签: linux sed

获取以下错误:

Command:

binary_setup()
{
CRS_VERSION=`${GRID_HOME}/OPatch/opatch lsinventory | ${GREPCMD} "Oracle Database" | tail -1 | ${AWKCMD} '{print $(NF-0)}'`;
}


Error:
Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)

Command:
AWKCMD=`which awk`;
GREPCMD=`which egrep`;
SEDCMD=`which sed`;
CATCMD=`which cat`;
WCCMD=`which wc`;
TRCMD=`which tr`;
SORTCMD=`which sort`;
ECHOCMD=`which echo`;
PRINTFCMD=`which printf`;
COLUMNCMD=`which column`;

${CATCMD} $0 | ${GREPCMD} "HELP:" | ${GREPCMD} -v "GREPCMD" | ${SEDCMD} 's/^.*\crsstat\/\crsstat\/g';


Error:
/bin/sed: -e expression #1, char 255: unterminated `s' command
/bin/sed: -e expression #1, char 0: no previous regular expression

1 个答案:

答案 0 :(得分:2)

您正在执行s/foo/bar搜索/替换正则表达式,但没有替换术语:

's/^.*\crsstat\/\crsstat\/g';
  ^--start search pattern
     + no unescaped /, so the pattern never ends

也许

's/^.*\crsstat/\crsstat/g';
              ^--no \--^

代替?