sed -i 's/old_text/new_text/' filename.txt
sed -i 's/old_text/new_text/g' filename.txt
sed -i '3d' filename.txt
sed -i '$d' filename.txt
sed -i '/pattern/d' filename.txt
cat > newfile.txt <<EOFThis is line 1.This is line 2.You are writing content directly from the terminal.EOF
cat >> existingfile.txt <<EOFThis line is appended to the end.EOF
echo "New line of text" >> filename.txt
echo "This will replace the entire file" > filename.txt
printf "Line 1\nLine 2\n" > filename.txt
本文链接:https://www.jingber.cn/post/3983.html 转载需授权!

微信扫一扫,打赏作者吧~