sed: replace line
2008年09月01日 (linux)
command
% cat sedtest.txt EXEC-PREFIX="./_install" PREFIX="./_install" % sed '1,$s;PREFIX="\./_install";PREFIX="/usr/local/bin";' sedtest.txt #1 EXEC-PREFIX="/usr/local/bin" PREFIX="/usr/local/bin" % sed '1,$s;PREFIX=.*;PREFIX="/usr/local/bin";' sedtest.txt #2 EXEC-PREFIX="/usr/local/bin" PREFIX="/usr/local/bin" % sed '1,$s;^PREFIX=.*;PREFIX="/usr/local/bin";' sedtest.txt #3 EXEC-PREFIX="./_install" PREFIX="/usr/local/bin" % 1.PREFIX="./_install"をPREFIX="/usr/local/bin"に置換 2.PREFIX=から始まる任意の文字列をFREFIX="/usr/local/bin"に置換 3.PREFIX=から始まる行をFREFIX="/usr/local/bin"に置換
note
cf. % man sed
PR
Comment