11
command , shell script ,tool , crontab / ต้องการ grep หาคำ และทำการ sed ให้เป็น คำใหม่
« Last post by golfreeze on สิงหาคม 20, 2023, 12:32:48 PM »#วันนี้มีโจทย์ grep เจอชื่อไฟล์ ทั้งหมดที่เจอคำว่า http และให้เปลี่ยนเป็นคำว่า https ภายใต้ folder "domain"
grep -rl "http://abc" *.php | xargs sed -i 's/http/https/g'
ถ้าเจอ1 file แก้ธรรมดาได้ แต่ถ้าเจอ 1000 file ก็ command ข้างบนได้เลยครับ ^_
grep -rl "http://abc" *.php | xargs sed -i 's/http/https/g'
ถ้าเจอ1 file แก้ธรรมดาได้ แต่ถ้าเจอ 1000 file ก็ command ข้างบนได้เลยครับ ^_