replace หลายจุด และหลาย pattern พร้อมกันจบในการรันคำสั่งครั้งเดียว
ใช้คำสั่ง sed รันผ่านโปรเเกรม cygwin64 ติดตั้งใน window
sed.exe -i.bak 's/Directory/zzzzz/;s/Microsoft/bbbb/;s/(ADDS)/cccc/' D:/test2/example.txt
คำสั่งนี้หมายถึงง
s/Directory/zzzzz/ ถ้าเจอคำว่า Directory ในไฟล์ D:/test2/example.txt ให้ replace ทุกจุดที่พบด้วยคำว่า zzzzz
s/Microsoft/bbbb/ ถ้าเจอคำว่า Microsoft ในไฟล์ D:/test2/example.txt ให้ replace ทุกจุดที่พบด้วยคำว่า bbbb
s/(ADDS)/cccc/ ถ้าเจอคำว่า (ADDS) ในไฟล์ D:/test2/example.txt ให้ replace ทุกจุดที่พบด้วยคำว่า cccc
โดยจะเก็บไฟล์ original ก่อน replace ไว้ที่ D:/test2/example.bak ให้ด้วย
ถ้าต้องการดู option อื่นๆของคำสั่ง sed.exe ก็พิมพ์ sed.exe -h แล้วกด enter ครับ
ข้อความที่ถูก replace เสร็จแล้ว
Active zzzzz, like many information-technology efforts, originated out of a democratization of design using Request for Comments or RFCs. The Internet Engineering Task Force (IETF), which oversees the RFC process, has accepted numerous RFCs initiated by widespread participants. Active zzzzz incorporates decades of communication technologies into the overarching Active zzzzz concept then makes improvements upon them.cccccitation needed] For example, LDAP underpins Active Directory. Also X.500 directories and the Organizational Unit preceded the Active Directory concept that makes use of those methods. The LDAP concept began to emerge even before the founding of bbbb in April 1975, with RFCs as early as 1971. RFCs contributing to LDAP include RFC 1823 (on the LDAP API, August 1995),[6]RFC 2307, RFC 3062, and RFC 4533.[7][8][9]
bbbb previewed Active zzzzz in 1999, released it first with Windows 2000 Server edition, and revised it to extend functionality and improve administration in Windows Server 2003. Additional improvements came with subsequent versions of Windows Server. In Windows Server 2008, additional services were added to Active zzzzz, such as Active zzzzz Federation Services.cccc10] The part of the directory in charge of management of domains, which was previously a core part of the operating system,[10] was renamed Active Directory Domain Services cccc and became a server role like others.[3] "Active Directory" became the umbrella title of a broader range of directory-based services.[11] According to Bryon Hynes, everything related to identity was brought under Active Directory's banner
ข้อความ original
Active Directory, like many information-technology efforts, originated out of a democratization of design using Request for Comments or RFCs. The Internet Engineering Task Force (IETF), which oversees the RFC process, has accepted numerous RFCs initiated by widespread participants. Active Directory incorporates decades of communication technologies into the overarching Active Directory concept then makes improvements upon them.[citation needed] For example, LDAP underpins Active Directory. Also X.500 directories and the Organizational Unit preceded the Active Directory concept that makes use of those methods. The LDAP concept began to emerge even before the founding of Microsoft in April 1975, with RFCs as early as 1971. RFCs contributing to LDAP include RFC 1823 (on the LDAP API, August 1995),[6]RFC 2307, RFC 3062, and RFC 4533.[7][8][9]
Microsoft previewed Active Directory in 1999, released it first with Windows 2000 Server edition, and revised it to extend functionality and improve administration in Windows Server 2003. Additional improvements came with subsequent versions of Windows Server. In Windows Server 2008, additional services were added to Active Directory, such as Active Directory Federation Services.[10] The part of the directory in charge of management of domains, which was previously a core part of the operating system,[10] was renamed Active Directory Domain Services (ADDS) and became a server role like others.[3] "Active Directory" became the umbrella title of a broader range of directory-based services.[11] According to Bryon Hynes, everything related to identity was brought under Active Directory's banner
replace หลายจุด และหลาย pattern พร้อมกันจบในการรันคำสั่งครั้งเดียว
Moderator: mindphp, ผู้ดูแลกระดาน
- jataz2
- PHP Super Member
- โพสต์: 275
- ลงทะเบียนเมื่อ: 22/02/2011 11:48 am
-
- Similar Topics
- ตอบกลับ
- แสดง
- โพสต์ล่าสุด
-
- 0 ตอบกลับ
- 1729 แสดง
-
โพสต์ล่าสุด โดย Dive Demo
08/02/2017 4:08 pm
-
-
โพสต์ใหม่ replace() คำสั่งค้นหาแทนที่ใน javascript
โดย jamepiyawat » 20/11/2019 6:36 pm » ใน jQuery & Ajax Knowledge - 0 ตอบกลับ
- 1234 แสดง
-
โพสต์ล่าสุด โดย jamepiyawat
20/11/2019 6:36 pm
-
-
-
โพสต์ใหม่ การเขียนโปรแกรม แบบ MVC Pattern ของโปรแกรมเมอร์
โดย Before Dong » 12/09/2017 10:31 am » ใน พูดคุยเรื่องทั่วไป จับฉ่าย - 0 ตอบกลับ
- 782 แสดง
-
โพสต์ล่าสุด โดย Before Dong
12/09/2017 10:31 am
-
-
-
โพสต์ใหม่ อยากทราบวิธีเขียน Pattern preg_match_all มันเขียนยังไง
โดย thatsawan » 03/11/2016 11:19 am » ใน Programming - PHP - 3 ตอบกลับ
- 663 แสดง
-
โพสต์ล่าสุด โดย บุคคลทั่วไป
27/07/2022 4:10 am
-
-
-
โพสต์ใหม่ ต้องการจะค้นหาไฟล์ใน folder ตาม pattern เขียนยังไงได้บ้างค่ะ
โดย thatsawan » 13/05/2019 5:36 pm » ใน Programming - PHP - 2 ตอบกลับ
- 996 แสดง
-
โพสต์ล่าสุด โดย thatsawan
14/05/2019 3:52 pm
-
ผู้ใช้งานขณะนี้
สมาชิกกำลังดูบอร์ดนี้: ไม่มีสมาชิกใหม่ และบุคลทั่วไป 91