Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在目录中附加一行文本所有文本文件(* .log),原因是,我想在应用程序日志中插入一个“标记”文本以插入断点。
谢谢。
使用“for”循环的一种方法:
for i in *.log; do echo "MARKER" >> "$i"; done
perl -i -lne 'if(eof){print $_."\MARK"}else{print}' *.log
使用 sed:
sed -i '$a MARKER' *.log