<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>shell script &#8211; Rafael Bernard Araujo</title>
	<atom:link href="https://rafael.bernard-araujo.com/tag/shell-script/feed" rel="self" type="application/rss+xml" />
	<link>https://rafael.bernard-araujo.com</link>
	<description>desenvolvendo... while(!success){  try(); }</description>
	<lastBuildDate>Wed, 03 Nov 2021 23:59:25 +0000</lastBuildDate>
	<language>pt-BR</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
<site xmlns="com-wordpress:feed-additions:1">21941730</site>	<item>
		<title>Substituindo o mesmo texto em arquivos diferentes</title>
		<link>https://rafael.bernard-araujo.com/substituindo-o-mesmo-texto-em-arquivos-diferentes.php</link>
					<comments>https://rafael.bernard-araujo.com/substituindo-o-mesmo-texto-em-arquivos-diferentes.php#comments</comments>
		
		<dc:creator><![CDATA[rafael]]></dc:creator>
		<pubDate>Mon, 18 Feb 2013 12:13:58 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[shell script]]></category>
		<guid isPermaLink="false">http://rafael.bernard-araujo.com/?p=1033</guid>

					<description><![CDATA[Dificuldade: Intermediário Aplicação: find / Perl Se você tem um texto que deseja substituir em vários locais, há várias maneiras de fazer isso. Para substituir o texto Windows por Linux em todos os arquivos no diretório atual chamado teste[alguma coisa] você pode executar o seguinte: perl -i -pe 's/Windows/Linux/;' test* Para substituir o texto Windows [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Dificuldade: Intermediário<br />
Aplicação: find / Perl</p>
<p>Se você tem um texto que deseja substituir em vários locais, há várias maneiras de fazer isso. Para substituir o texto Windows por Linux em todos os arquivos no diretório atual chamado teste[alguma coisa] você pode executar o seguinte:</p>
<pre class="bash" style="font-size:px;color: #;"><span style="color: #c20cb9; font-weight: bold;color: #">perl</span> <span style="color: #660033;">-i</span> <span style="color: #660033;">-pe</span> <span style="color: #ff0000;">'s/Windows/Linux/;'</span> <span style="color: #7a0874; font-weight: bold;color: #">test</span><span style="color: #000000; font-weight: bold;color: #">*</span></pre>
<p>Para substituir o texto Windows por Linux em todos os arquivos de texto no diretório atual e para baixo você pode executar este:</p>
<pre class="bash" style="font-size:px;color: #;"><span style="color: #c20cb9; font-weight: bold;color: #">find</span> . <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*.txt'</span> <span style="color: #660033;">-print</span> <span style="color: #000000; font-weight: bold;color: #">|</span> <span style="color: #c20cb9; font-weight: bold;color: #">xargs</span> <span style="color: #c20cb9; font-weight: bold;color: #">perl</span> <span style="color: #660033;">-pi</span> <span style="color: #660033;">-e</span><span style="color: #ff0000;">'s/Windows/Linux/ig'</span> <span style="color: #000000; font-weight: bold;color: #">*</span>.txt</pre>
<p>Ou se você preferir isso também vai funcionar, mas apenas em arquivos regulares:</p>
<pre class="bash" style="font-size:px;color: #;"><span style="color: #c20cb9; font-weight: bold;color: #">find</span> <span style="color: #660033;">-type</span> f <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*.txt'</span> <span style="color: #660033;">-print0</span> <span style="color: #000000; font-weight: bold;color: #">|</span> <span style="color: #c20cb9; font-weight: bold;color: #">xargs</span> <span style="color: #660033;">--null</span> <span style="color: #c20cb9; font-weight: bold;color: #">perl</span> <span style="color: #660033;">-pi</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'s/Windows/Linux/'</span></pre>
<p>Economiza muito tempo e tem uma classificação de guru alta!</p>
<p>De <a title="Dicas de Linux que todo geek deve saber" href="http://rafael.bernard-araujo.com/dicas-de-linux-que-todo-geek-deve-saber.php">Dicas de Linux que todo geek deve saber</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://rafael.bernard-araujo.com/substituindo-o-mesmo-texto-em-arquivos-diferentes.php/feed</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1033</post-id>	</item>
		<item>
		<title>Dicas de Linux que todo geek deve saber</title>
		<link>https://rafael.bernard-araujo.com/dicas-de-linux-que-todo-geek-deve-saber.php</link>
					<comments>https://rafael.bernard-araujo.com/dicas-de-linux-que-todo-geek-deve-saber.php#comments</comments>
		
		<dc:creator><![CDATA[rafael]]></dc:creator>
		<pubDate>Sat, 28 Jul 2012 02:53:02 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[shell script]]></category>
		<guid isPermaLink="false">http://rafael.bernard-araujo.com/?p=1010</guid>

					<description><![CDATA[Fonte: Linux tips every geek should know O que separa os usuários normais dos super-geeks? Simples: anos gastos aprendendo maneiras de desmantelar códigos, truques, dicas e técnicas que transformam grandes esforço num trabalho de um momento. Se você quer ganhar agilidade para colocar as mãos á obra, separamos 50 dicas fáceis de aprender para lhe [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Fonte: <a title=" Linux tips every geek should know" href="https://web.archive.org/web/20180322200847/http://www.tuxradar.com:80/content/linux-tips-every-geek-should-know">Linux tips every geek should know</a></p>
<p>O que separa os usuários normais dos super-geeks? Simples: anos gastos aprendendo maneiras de desmantelar códigos, truques, dicas e técnicas que transformam grandes esforço num trabalho de um momento. Se você quer ganhar agilidade para colocar as mãos á obra, separamos 50 dicas fáceis de aprender para lhe ajudar a trabalhar com mais eficiência e obter o máximo do seu computador. Aproveite!</p>
<ol>
<li><a title="Verifique os processos que estão rodando e que não são os seus" href="http://rafael.bernard-araujo.com/verifique-os-processos-que-estao-rodando-e-que-nao-sao-os-seus.php">Verifique os processos que estão rodando e que não são os seus</a></li>
<li><a title="Substituindo o mesmo texto em arquivos diferentes" href="http://rafael.bernard-araujo.com/substituindo-o-mesmo-texto-em-arquivos-diferentes.php">Substituindo o mesmo texto em arquivos diferentes</a></li>
<li><a title="Consertar um terminal problemático" href="http://rafael.bernard-araujo.com/consertar-um-terminal-problematico.php">Consertar um terminal problemático</a></li>
</ol>
]]></content:encoded>
					
					<wfw:commentRss>https://rafael.bernard-araujo.com/dicas-de-linux-que-todo-geek-deve-saber.php/feed</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1010</post-id>	</item>
		<item>
		<title>Backup de todos os bancos do servidor PostgreSQL</title>
		<link>https://rafael.bernard-araujo.com/backup-de-todos-os-bancos-do-servidor-postgresql.php</link>
					<comments>https://rafael.bernard-araujo.com/backup-de-todos-os-bancos-do-servidor-postgresql.php#respond</comments>
		
		<dc:creator><![CDATA[rafael]]></dc:creator>
		<pubDate>Thu, 21 Jun 2012 14:34:24 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[PostGreSQL]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[shell script]]></category>
		<guid isPermaLink="false">http://rafael.bernard-araujo.com/?p=997</guid>

					<description><![CDATA[Extremamente útil, ainda mais quando há possibilidade de criação de banco de dados de forma automatizada (servidores de hospedagem, por exemplo). Download]]></description>
										<content:encoded><![CDATA[<p>Extremamente útil, ainda mais quando há possibilidade de criação de banco de dados de forma automatizada (servidores de hospedagem, por exemplo).</p>
<p><script src="https://gist.github.com/rafaelbernard/2966026.js"></script></p>
<p><a href="https://gist.github.com/rafaelbernard/2966026/raw/b3711c06976d90f8d46394c32277dbe871147dc2/bac_all_db_pg.sh" title="GIST - Backup de todos os bancos do servidor PostgreSQL">Download</a></p>
<p><!--


<pre class="bash shell">#!/bin/bash
# Baseado em http://mig5.net/content/mysql-postgresql-all-databases-backup-script
# Rafael Bernard Rodrigues Araujo - 14/06/2012

today=$(date +%y%m%d)

# local dir where the backups go
myDir='/disk2/backup/pg'

# this is for PostgreSQL. If you don't need it, you
# could leave it here, but remove the 'backup_pgsql'
# function call at the end of the script

CMD_PSQL=/usr/local/pgsql/bin/psql
CMD_DUMP=/usr/local/pgsql/bin/pg_dump
arq_tar=''

function backup_pgsql {
        #Seleciona os bancos a serem copiados, eliminando os bancos de sistema
        for db in `psql -U postgres -tq -d template1 -c "select datname from pg_database where datname not in ('template1','template0','postgres')"`; do
echo 'Iniciando o backup de '${db};
                arq_tar="${myDir}/${db}-${today}.tar";
                pg_dump -U postgres -F tar -f $arq_tar $db;
                gzip $arq_tar;
                echo 'Backup concluido';
        done;
}

backup_pgsql</pre>

--></p>
]]></content:encoded>
					
					<wfw:commentRss>https://rafael.bernard-araujo.com/backup-de-todos-os-bancos-do-servidor-postgresql.php/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">997</post-id>	</item>
	</channel>
</rss>
