{"id":74,"date":"2017-03-13T19:00:09","date_gmt":"2017-03-13T19:00:09","guid":{"rendered":"https:\/\/nmbm.biz\/sitio\/?p=74"},"modified":"2019-11-30T22:49:47","modified_gmt":"2019-11-30T22:49:47","slug":"linux-procurar-texto-dentro-de-ficheiros","status":"publish","type":"post","link":"https:\/\/blog.webgescom.pt\/blog\/linux-procurar-texto-dentro-de-ficheiros\/","title":{"rendered":"Linux: procurar texto dentro de ficheiros"},"content":{"rendered":"\n<p> Como saber que ficheiros cont\u00eam determinada express\u00e3o? <\/p>\n\n\n\n<p> O comando grep, do Linux, \u00e9 a ferramenta perfeita. Diz, inclusiv\u00e9, em que linha a express\u00e3o surge, para al\u00e9m do caminho e nome do ficheiro.  <\/p>\n\n\n\n<p>Na shell do Linux, executar: <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"> grep -rnw 'caminho-onde-poderao-estar-os-ficheiros' -e \"expressao\" <\/pre>\n\n\n\n<p>Onde:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>-r&nbsp;&nbsp; &#8211; recursive (leitura dentro da hierarquia da&nbsp; pasta)<\/li><li>-n&nbsp; &#8211; n\u00famero da linha<\/li><li>-w&nbsp; &#8211; correspond\u00eancia da totalidade da express\u00e3o<\/li><\/ul>\n\n\n\n<p>leia o <a href=\"http:\/\/stackoverflow.com\/questions\/16956810\/how-to-find-all-files-containing-specific-text-on-linux\">artigo original<\/a> completo<\/p>\n<div class=\"pvc_clear\"><\/div><p id=\"pvc_stats_74\" class=\"pvc_stats all  \" data-element-id=\"74\" style=\"\"><i class=\"pvc-stats-icon small\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/blog.webgescom.pt\/blog\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p><div class=\"pvc_clear\"><\/div>","protected":false},"excerpt":{"rendered":"<p>Como saber que ficheiros cont\u00eam determinada express\u00e3o? O comando grep, do Linux, \u00e9 a ferramenta perfeita. Diz, inclusiv\u00e9, em que linha a express\u00e3o surge, para al\u00e9m do caminho e nome do ficheiro. Na shell do Linux, executar: grep -rnw &#8216;caminho-onde-poderao-estar-os-ficheiros&#8217; -e &#8220;expressao&#8221; Onde: -r&nbsp;&nbsp; &#8211; recursive (leitura dentro da hierarquia da&nbsp; pasta) -n&nbsp; &#8211; n\u00famero&hellip;&nbsp;<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_74\" class=\"pvc_stats all  \" data-element-id=\"74\" style=\"\"><i class=\"pvc-stats-icon small\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/blog.webgescom.pt\/blog\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","footnotes":""},"categories":[9],"tags":[10,11,12],"class_list":["post-74","post","type-post","status-publish","format-standard","hentry","category-linux","tag-grep","tag-linux","tag-shell"],"aioseo_notices":[],"a3_pvc":{"activated":true,"total_views":905,"today_views":0},"_links":{"self":[{"href":"https:\/\/blog.webgescom.pt\/blog\/wp-json\/wp\/v2\/posts\/74","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.webgescom.pt\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.webgescom.pt\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.webgescom.pt\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.webgescom.pt\/blog\/wp-json\/wp\/v2\/comments?post=74"}],"version-history":[{"count":2,"href":"https:\/\/blog.webgescom.pt\/blog\/wp-json\/wp\/v2\/posts\/74\/revisions"}],"predecessor-version":[{"id":593,"href":"https:\/\/blog.webgescom.pt\/blog\/wp-json\/wp\/v2\/posts\/74\/revisions\/593"}],"wp:attachment":[{"href":"https:\/\/blog.webgescom.pt\/blog\/wp-json\/wp\/v2\/media?parent=74"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.webgescom.pt\/blog\/wp-json\/wp\/v2\/categories?post=74"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.webgescom.pt\/blog\/wp-json\/wp\/v2\/tags?post=74"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}