在我的脚本中,我正在获取一个文本文件并逐行浏览文件并将字符串“test”替换为“true”,然后将其重定向到一个新文件。这是我的代码:
cat $FILENAME | while read LINE
do
echo "$LINE" | sed -e `s/test/true/g` > $NEWFILE
done
但是,当我执行脚本时,出现以下错误:
/home/deploy/KScript/scripts/Stack.sh: line 46: s/test/true/g: No such file or directory
sed: option requires an argument -- e
Usage: sed [OPTION]... {script-only-if-no-other-script} [input-file]...
-n, --quiet, --silent
suppress automatic printing of pattern space
-e script, --expression=script
add the script to the commands to be executed
-f script-file, --file=script-file
add the contents of script-file to the commands to be executed
-i[SUFFIX], --in-place[=SUFFIX]
edit files in place (makes backup if extension supplied)
-c, --copy
use copy instead of rename when shuffling files in -i mode
(avoids change of input file ownership)
-l N, --line-length=N
specify the desired line-wrap length for the `l' command
--posix
disable all GNU extensions.
-r, --regexp-extended
use extended regular expressions in the script.
-s, --separate
consider files as separate rather than as a single continuous
long stream.
-u, --unbuffered
load minimal amounts of data from the input files and flush
the output buffers more often
--help display this help and exit
--version output version information and exit
你能帮我找出我做错了什么吗?