을 대체 내가 파일에경로
(setq myFile "/some/path")
에 경로를 대체합니다.
find ./_build/html -type f -name '*.html' | while read myFile; do
MyFile=`readlink -f "$myFile"`
sed -i "s/setq myFile [)]*/setq myFile \"$MyFile\"/" sphinx_nowrap.el
# and then some actions on file
done
와 펄과 : 내가 나오지도 함께 할 것을 시도
find ./_build/html -type f -name '*.html' | while read myFile; do
MyFile=`readlink -f "$myFile"`
perl -ne "s/setq myFile .+/setq myFile \"$MyFile\")/" sphinx_nowrap.el
# and then some actions on file
done
을하지만 모두 오류를 제공합니다.
나는 this과 this 및 this으로 읽었지만 제대로 작동하지 않습니다.
편집 :
sed: -e expression #1, char 34: unknown option to `s'
편집 2 : 여기
Having no space between pattern and following word is deprecated at -e line 1.
Bareword found where operator expected at -e line 1, near "s/setq myFile .+/setq myFile "/home"
String found where operator expected at -e line 1, at end of line
(Missing semicolon on previous line?)
syntax error at -e line 1, near "s/setq myFile .+/setq myFile "/home"
Can't find string terminator '"' anywhere before EOF at -e line 1.
및 오류 나오지도 있어요 :
이그래서 솔루션이다
여기에 펄 오류입니다 기음 delimeter char를 hange하십시오. 또한 SED 식을 변경해야합니다 :
sed -i "s!setq myFile .*!setq myFile \"$MyFile\")!" sphinx_nowrap.el
그리고 그 오류가 무엇을 할 수 있는가? –
오류를 추가 할 수 있습니다. – Stephan