{"id":294,"date":"2021-09-08T12:32:11","date_gmt":"2021-09-08T12:32:11","guid":{"rendered":"https:\/\/demirel.web.tr\/?p=294"},"modified":"2021-09-08T12:32:13","modified_gmt":"2021-09-08T12:32:13","slug":"bash-komutu-ile-bir-dosyadaki-satir-aralarini-bulma","status":"publish","type":"post","link":"https:\/\/demirel.web.tr\/?p=294","title":{"rendered":"Bash Komutu ile Bir Dosyadaki Sat\u0131r Aralar\u0131n\u0131 Bulma"},"content":{"rendered":"\n<p>Linux ve Unix gibi sistemler ile \u00e7al\u0131\u015fanlar siyah ekranla \u00e7al\u0131\u015fmaya al\u0131\u015f\u0131kt\u0131r. Pek \u00e7ok \u015fey komut sat\u0131r\u0131ndan yani terminal \u00fczerinden komutlarla halledebilir. Bash ya da python gibi betikler kullanarak bu komutlar d\u00fczenli bir program dosyas\u0131 \u00fczerinden \u00e7al\u0131\u015ft\u0131r\u0131labilir. A\u015fa\u011f\u0131da bir text dosyas\u0131nda 3 sat\u0131r \u00f6ncesi 5 sat\u0131r sonras\u0131 ya da verilecek farkl\u0131 de\u011ferler ile bir ifadeyi aratarak bulma komutunu g\u00f6sterece\u011fim. <\/p>\n\n\n\n<p>Bu komut s parametresi ile verilen &#8220;abcd&#8221; ifadesini file ile belirtilen dosyada b parametresi ile verilen 3 sat\u0131r \u00f6ncesi ve a parametresi ile verilen 5 sat\u0131r sonras\u0131 \u015feklinde aratarak konsol ekran\u0131na yazd\u0131r\u0131r.<\/p>\n\n\n\n<p><strong>awk &#8216;c&#8211;>0;$0~s{if(b)for(c=b+1;c>1;c&#8211;)print r[(NR-c+1)%b];print;c=a}b{r[NR%b]=$0}&#8217; b=3 a=5 s=&#8221;abcd&#8221; file<\/strong><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Linux ve Unix gibi sistemler ile \u00e7al\u0131\u015fanlar siyah ekranla \u00e7al\u0131\u015fmaya al\u0131\u015f\u0131kt\u0131r. Pek \u00e7ok \u015fey komut sat\u0131r\u0131ndan yani terminal \u00fczerinden komutlarla halledebilir. Bash ya da python gibi betikler kullanarak bu komutlar&hellip;<a href=\"https:\/\/demirel.web.tr\/?p=294\" class=\"more-link\"><span class=\"more-button\">Continue reading<span class=\"screen-reader-text\">Bash Komutu ile Bir Dosyadaki Sat\u0131r Aralar\u0131n\u0131 Bulma<\/span><\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"_links":{"self":[{"href":"https:\/\/demirel.web.tr\/index.php?rest_route=\/wp\/v2\/posts\/294"}],"collection":[{"href":"https:\/\/demirel.web.tr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/demirel.web.tr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/demirel.web.tr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/demirel.web.tr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=294"}],"version-history":[{"count":1,"href":"https:\/\/demirel.web.tr\/index.php?rest_route=\/wp\/v2\/posts\/294\/revisions"}],"predecessor-version":[{"id":295,"href":"https:\/\/demirel.web.tr\/index.php?rest_route=\/wp\/v2\/posts\/294\/revisions\/295"}],"wp:attachment":[{"href":"https:\/\/demirel.web.tr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=294"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/demirel.web.tr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=294"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/demirel.web.tr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=294"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}