Deleting comment lines

เวลาที่ไฟล์สำหรับ Config ที่มี Comment เยอะ ๆ แล้วต้องการลบออกให้หมด ทำได้โดยใช้คำสั่ง

sed '/^\#/d' myFile > tt
mv tt myFile

ความหมาย:
sed '/^\#/d' myFile : removes all lines starting with # from the file myFile and outputs the result in the console,
> tt : redirects the output into a temporary file called tt,
mv tt myFile : moves the temporary file tt to myFile.

ที่มา : http://soft.zoneo.net/Linux/remove_comment_lines.php
อีกวิธี : http://linuxconfig.org/remove-comment-lines-from-linux-config-files

Comments

Popular posts from this blog

Artillery Hornet + OctoPrint + Klipper

ย้ายบ้าน

ใต้ร่มกาสาวพัตร