sed rare-delimiter (other than & | / ?…)

后端 未结 8 2148
傲寒
傲寒 2020-12-17 17:42

I\'ve to apply the Unix command sed on a string (can contain #, !, /, ?, &, @ and all other characters) which can contains all types of

8条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-17 18:29

    With the help of Jim Lewis, I finally did a test before using sed :

    if [ `echo $1 | grep '|'` ]; then
        grep ".*$1.*:" $DB_FILE  | sed "s@^.*$1*.*\(:\)@@ "
    else
        grep ".*$1.*:" $DB_FILE  | sed "s|^.*$1*.*\(:\)|| "
    fi
    

    Thanks for help

提交回复
热议问题