ใช้ Powershell แบบ Linux Shell Script

รวบรวมการทำงานกับ Powershell บน Windows โดยเทียบเคียงกับการใช้ ShellScript บน Linux (ทะยอยเขียนบันทึก โปรดติดตามเรื่อยๆ) เลือกบางบรรทัดจากไฟล์ที่มีคำที่ต้องการอยู่ shellscript: grep someword textfile.txt powershell: select-string “someword” textfile.txt เลือกบางบรรทัดจากไฟล์ แล้วแยกด้วยเครื่องหมาย : เพื่อเอาฟิลด์ที่ 3 shellscript: grep someword textfile.txt | awk -f ‘{FS=”:”}{print $3}’ powershell: select string “someword” textfile.txt | % { $_.line.split(‘:’)[2];  } เลือกบางบรรทัดจากไฟล์ แล้วเอาลงไฟล์ shellscript: grep someword textfile.txt  > output.txt powershell: select string “someword” … Read more