{"id":723,"date":"2020-03-12T09:41:43","date_gmt":"2020-03-12T08:41:43","guid":{"rendered":"https:\/\/blog.mhasin.eu\/?p=723"},"modified":"2020-03-12T09:58:19","modified_gmt":"2020-03-12T08:58:19","slug":"bash-uprava-textu-spocitanie-riadkov-grep-ip-zoradenie-ip-uniq","status":"publish","type":"post","link":"https:\/\/blog.mhasin.eu\/?p=723","title":{"rendered":"bash upr\u00e1va textu, spo\u010d\u00edtanie riadkov, grep IP, zoradenie IP, uniq"},"content":{"rendered":"\n<p>Odstranenie ridkov z textoveho suboru. Zmazanie prvych 51 riadkov zo suboru:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sed '1,51d' text.log > output\n<\/code><\/pre>\n\n\n\n<p>Vybratie zo suboru iba IP adresy:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> grep -E -o \"([0-9]{1,3}[\\.]){3}[0-9]{1,3}\" ip.log<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large is-style-zoooom\"><img loading=\"lazy\" decoding=\"async\" width=\"595\" height=\"72\" src=\"https:\/\/blog.mhasin.eu\/wp-content\/uploads\/2020\/03\/obr\u00e1zok-15.png\" alt=\"\" class=\"wp-image-724\" srcset=\"https:\/\/blog.mhasin.eu\/wp-content\/uploads\/2020\/03\/obr\u00e1zok-15.png 595w, https:\/\/blog.mhasin.eu\/wp-content\/uploads\/2020\/03\/obr\u00e1zok-15-300x36.png 300w\" sizes=\"auto, (max-width: 595px) 100vw, 595px\" \/><\/figure>\n\n\n\n<p>Zoradenie Ip adresy podla postupnosti:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sort -t . -k 3,3n -k 4,4n  ip<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>-t .<\/strong> : Set field to . (dot) as our IPs separated by dot symbol<\/li><li><strong> -n<\/strong> : Makes the program sort according to numerical value<\/li><li><strong>-k opts<\/strong>:\n Sort data \/ fields using the given column number. For example, the \noption -k 2 made the program sort using the second column of data. The \noption -k 3,3n -k 4,4n sorts each column. First it will sort 3rd column \nand then 4th column.<\/li><\/ul>\n\n\n\n<div class=\"wp-block-image is-style-zoooom\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"439\" height=\"67\" src=\"https:\/\/blog.mhasin.eu\/wp-content\/uploads\/2020\/03\/obr\u00e1zok-16.png\" alt=\"\" class=\"wp-image-725\" srcset=\"https:\/\/blog.mhasin.eu\/wp-content\/uploads\/2020\/03\/obr\u00e1zok-16.png 439w, https:\/\/blog.mhasin.eu\/wp-content\/uploads\/2020\/03\/obr\u00e1zok-16-300x46.png 300w\" sizes=\"auto, (max-width: 439px) 100vw, 439px\" \/><\/figure><\/div>\n\n\n\n<p>Spojenie unikatnych IP adries a vypisanie iba jedneho vyskitu rovakeho zaznamu:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>uniq -u<\/code><\/pre>\n\n\n\n<p><\/p>\n<div class=\"pdf24Plugin-cp\"> \t<form name=\"pdf24Form0\" method=\"post\" action=\"https:\/\/doc2pdf.pdf24.org\/wordpress.php\" target=\"pdf24PopWin\" onsubmit=\"var pdf24Win = window.open('about:blank', 'pdf24PopWin', 'resizable=yes,scrollbars=yes,width=600,height=250,left='+(screen.width\/2-300)+',top='+(screen.height\/3-125)+''); pdf24Win.focus(); if(typeof pdf24OnCreatePDF === 'function'){void(pdf24OnCreatePDF(this,pdf24Win));}\"> \t\t<input type=\"hidden\" name=\"blogCharset\" value=\"Cw1x07UAAA==\" \/><input type=\"hidden\" name=\"blogPosts\" value=\"MwQA\" \/><input type=\"hidden\" name=\"blogUrl\" value=\"yygpKSi20tdPyslP18vNSCzOzNNLLQUA\" \/><input type=\"hidden\" name=\"blogName\" value=\"c\/LxdwcA\" \/><input type=\"hidden\" name=\"blogValueEncoding\" value=\"gzdeflate base64\" \/><input type=\"hidden\" name=\"postId_0\" value=\"MzcyBgA=\" \/><input type=\"hidden\" name=\"postTitle_0\" value=\"S0oszlAoLSg6vLAsUaEktaKkVEehuCD\/SO\/htSWJeZmpCkWZiSnZ+WU6CulFqQUKngE6ClX5RYkpqSA5EK80L7MQAA==\" \/><input type=\"hidden\" name=\"postLink_0\" value=\"yygpKSi20tdPyslP18vNSCzOzNNLLdW3L7A1NzIGAA==\" \/><input type=\"hidden\" name=\"postAuthor_0\" value=\"y00syfcwNAIA\" \/><input type=\"hidden\" name=\"postDateTime_0\" value=\"MzIwMtA1MNY1NFIwsLQyMLYyMQYA\" \/><input type=\"hidden\" name=\"postContent_0\" value=\"rVXbbtNAEH3PV4z8QivFdq6tGjl5A4kHBFIRD1weJt6ts2S9u+zFjYP4GL6FH2O8bkOqgKCifrC99vic452ZM4PCrF4z5y0qrgQHK9hWN7AHz3deN3yjwYW1tiGD9zXusYsxtmnLDczHFI19+H3UosjNakBHYSyHUqJzy+TWpGupy21aasaTVdFdVo4zeDYezsfsWeTKpK5gBTp4E\/ygyGMQoVl+h7d6164teuI\/sIFYI7x8A8gsd+2\/c0NluYH0OaQakrMPo\/Tq09fxcPrtw8fs0\/lXuh6eJCBMp+xUz42owm9oRI0VByf2PJVo6Va41PlW8nSv6ahJgqgrkBqZUNUykbhvE2Cc4OMaXavKBG4F85tlMr+aJ7Dhotr4ZXI5ScDZcplsvDdukefEWGX1Bp1QGQ85aSi18lz5PJiOwOWT0WSUj6a5Xtsf3\/d6m47nmVFVAigJMDlSH3Wnl5NZ5HDcPwENkPzbIfwXTjodjXbTiwhHt7dJ3FvSjMHrIZzVuEvjZi06NrM7h\/Fo1BBrXCWQU876VN2X0XttkcVaf2nuKgeMZhLp7Hwwis7iEXWsrYfUQwbpFqbDqequs+FMAZXOadkEeYImhfOEJsWqoD7Uqlp1cEV+t4AFXHMPN4JLBl4T0RnT\/hzQUbNYKn8Hjhuk1qCOWrdAL8G19VrLIu8wj3AhVcewr3DLHfhN19G6slhD\/BksS227auzYVKi5FSVKaFAGfgJJP6uNdwfYxQCuOxCGHiHvVTsILsIRUyUarqDUMtSqA19zm8ELbYHvsDaSD2PUgDCFjls5gZrSdaryF6Sj5lHsHlPfRO4M3j7EeZCaDsEBR3Kx\/jPSIKzzIDy1npQ9xdQeUAdIDESmYOYP3\/SbkQfZp5aJ5g92cOoBD90DpahUSZ3A7ZF1PM4qZtOrX1ZxcfkEVnHxF6uYP41V9L1N8v\/TKi6iVcz+ySqI7cgq4uqBVRQ5JfPeMK6N\/hz9IiixRa+62dcPHUHtg9C0Rrg4GLtx9Jkz1U3NpnVb4QNY3VCb0YM97hXWj5iQRPcF0vC7URgxfgI=\" \/> \t\t<a href=\"https:\/\/www.pdf24.org\" target=\"_blank\" title=\"www.pdf24.org\" rel=\"nofollow\"><img src=\"https:\/\/blog.mhasin.eu\/wp-content\/plugins\/pdf24-post-to-pdf\/img\/pdf_32x32.png\" alt=\"\" border=\"0\" height=\"32\" \/><\/a> \t\t<span class=\"pdf24Plugin-cp-space\">&nbsp;&nbsp;<\/span> \t\t<span class=\"pdf24Plugin-cp-text\">Send article as PDF<\/span> \t\t<span class=\"pdf24Plugin-cp-space\">&nbsp;&nbsp;<\/span> \t\t<input class=\"pdf24Plugin-cp-input\" style=\"margin: 0px;\" type=\"text\" name=\"sendEmailTo\" placeholder=\"Enter email address\" \/> \t\t<input class=\"pdf24Plugin-cp-submit\" style=\"margin: 0px;\" type=\"submit\" value=\"Send\" \/> \t<\/form> <\/div>","protected":false},"excerpt":{"rendered":"Odstranenie ridkov z textoveho suboru. Zmazanie prvych 51 riadkov zo suboru: Vybratie zo suboru iba IP adresy: Zoradenie Ip adresy podla postupnosti: -t . : Set field to . (dot) as our IPs separated by dot symbol -n : Makes the program sort according to numerical value -k opts: Sort data \/ fields using the given column number. For example, the option -k 2 made the program sort using the second column of data. The&hellip;\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"arc_restricted_post":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-723","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/blog.mhasin.eu\/index.php?rest_route=\/wp\/v2\/posts\/723","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.mhasin.eu\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.mhasin.eu\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.mhasin.eu\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.mhasin.eu\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=723"}],"version-history":[{"count":3,"href":"https:\/\/blog.mhasin.eu\/index.php?rest_route=\/wp\/v2\/posts\/723\/revisions"}],"predecessor-version":[{"id":728,"href":"https:\/\/blog.mhasin.eu\/index.php?rest_route=\/wp\/v2\/posts\/723\/revisions\/728"}],"wp:attachment":[{"href":"https:\/\/blog.mhasin.eu\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=723"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.mhasin.eu\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=723"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.mhasin.eu\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=723"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}