Sizin uygulamanızda, users2.txt dosyasının her bir satırında sadece kullanıcı ismi var sanırım, bu yüzden sorun çıkmamış olabilir. Ama "for i in `cat users2.txt`" şeklindeki bir okumada, her satır sonu ve boşluk karakteri yeni bir $i oluşturacaktır, dikkatli olun.
Örnek: # for i in `cat passwd`; do echo == $i ==; done deneyin. İyi çalışmalar Cemil From: [email protected] [mailto:[email protected]] On Behalf Of Taner KARAGÖL Sent: Thursday, June 09, 2016 4:00 PM To: Linux <[email protected]> Subject: [Linux] Re: sed ile passwd düzenlemesi. Bu işe yaradı, değişiklik yapılacak satır numarasını bulup sed ile değiştiriyorum: For i in `cat users2.txt` ; do sed -i `grep -n ^$i: passwd | awk -F":" '{print $1}'`'s/users/users2/g' passwd; done From: [email protected]<mailto:[email protected]> [mailto:[email protected]] On Behalf Of Cemil KELES Sent: Thursday, June 09, 2016 2:40 PM To: Linux <[email protected]<mailto:[email protected]>> Subject: [Linux] Re: sed ile passwd düzenlemesi. Merhaba, `cat users2.txt` sonrası her bir satırı ayrı okumanız gerekir sanırım: cat users2.txt | while read line do sed ....$line done şeklinde deneyebilir misiniz. İyi çalışmalar Cemil From: [email protected]<mailto:[email protected]> [mailto:[email protected]] On Behalf Of Taner KARAGÖL Sent: Thursday, June 09, 2016 2:36 PM To: Linux <[email protected]<mailto:[email protected]>> Subject: [Linux] sed ile passwd düzenlemesi. Merhaba; Passswd dosyasında bazı kullanıcıların ev dizinlerini users->users2 şeklinde değiştirmek istiyorum. Bu komut tek kullanıcı için, örneğin karagol kullanıcısı için çalışıyor: Sed -i 's/users\/karagol/users2\/karagol/g' passwd Değişiklik yapılacak kullanıcı listesi users2.txt dosyasında, for döngüsü ile sed çalışmıyor maalesef: For i in `cat users2.txt` ; do sed -i 's/users\/$i/users2\/$i/g' passwd; done Yaptığım yanlışlık nedir acaba. $i yerine ${i} "${i}" denedim ama yine olmadı. Basit bir syntax hatası olmalı. ________________________________ Dikkat: Bu elektronik posta mesaji kisisel ve ozeldir. Eger size gonderilmediyse lutfen gondericiyi bilgilendirip mesaji siliniz. Firmamiza gelen ve giden mesajlar virus taramasindan gecirilmekte, guvenlik nedeni ile kontrol edilerek saklanmaktadir. Mesajdaki gorusler ve bakis acisi gondericiye ait olup Aselsan A.S. resmi gorusu olmak zorunda degildir. ________________________________ Attention: This e-mail message is privileged and confidential. If you are not the intended recipient please delete the message and notify the sender. E-mails to and from the company are monitored for operational reasons and in accordance with lawful business practices. Any views or opinions presented are solely those of the author and do not necessarily represent the views of the company. ________________________________
_______________________________________________ Linux E-Posta Listesi [email protected] Liste kurallari: http://liste.linux.org.tr/kurallar.php Bu Listede neden bulunduğunuzu bilmiyorsanız veya artık bu listeden gelen e-postaları almak istemiyorsanız aşağıdaki bağlantı adresini kullanarak 1 dakika içinde üyeliğinizi sonlandırabilirsiniz. https://liste.linux.org.tr/mailman/listinfo/linux
