El comando para reemplazar un texto en varios ficheros es el siguiente
perl -p -i -e "s[texto_viejo][texto_nuevo]g" *.txt
Se utilizan expresiones regulares para que matcheen, en este caso son simples textos como "texto_viejo" y "texto_nuevo". Se pueden utilizar backslashes para caracteres especiales...
Es un comando MUY util
Leer más...
Este Blog fue creado el 31 de Marzo de 2011, para administrar diferentes enlaces de informacion, tecnologia, noticias, ocio, etc... Espero que les guste. Las Heras, Mendoza, Argentina. Drakeware
viernes, 25 de abril de 2014
Usar conexión USB como router de Internet en beaglebone (BBB)
Routeo de BBB hacia Internet mediante PC (USB)
En la beaglebone configurar la ruta y los dns:
# route add default gw 192.168.7.1
# echo "nameserver 8.8.8.8" > /etc/resolv.conf
En la pc donde tenemos conectada la beaglebone:
# echo 1 > /proc/sys/net/ipv4/ip_forward
# iptables -A POSTROUTING -t nat -j MASQUERADE
Testeamos conexión con ping:
root@beaglebone:~# ping yahoo.ca
PING yahoo.ca (68.180.206.184) 56(84) bytes of data.
64 bytes from w2.rc.vip.sp1.yahoo.com (68.180.206.184): icmp_req=1 ttl=54 time=201 ms
64 bytes from w2.rc.vip.sp1.yahoo.com (68.180.206.184): icmp_req=2 ttl=54 time=93.8 ms
64 bytes from w2.rc.vip.sp1.yahoo.com (68.180.206.184): icmp_req=3 ttl=54 time=88.9 ms
Eso es todo...
REMOTE HOST IDENTIFICATION HAS CHANGED
Recién, acababa de instalar una version de debian Wheezy en una beaglebone black, y al intentar conectarme por ssh me salió el siguiente mensaje:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX.
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending key in /root/.ssh/known_hosts:9
RSA host key for barrina.usr.xc.systemadmin.es has changed and you have requested strict checking.
Host key verification failed.
lost connection
Googleando encontré que esto sucede porque la identificación que posee ese equipo sobre nosotros ha cambiado, por algún motivo como reinstalación, desconfiguración, Y HASTA HACK!.
Al conectarse le enviamos nuestro key y al ser distinto nos rechaza. Lo que debemos hacer es, borrar la información local que tenemos sobre el host con
$ssh-keygen -R 192.168.1.20
/root/.ssh/known_hosts updated.
Original contents retained as /root/.ssh/known_hosts.old
Y luego volver a generar el key entre las máquinas con una conexión del tipo:
Leer más...
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX.
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending key in /root/.ssh/known_hosts:9
RSA host key for barrina.usr.xc.systemadmin.es has changed and you have requested strict checking.
Host key verification failed.
lost connection
Googleando encontré que esto sucede porque la identificación que posee ese equipo sobre nosotros ha cambiado, por algún motivo como reinstalación, desconfiguración, Y HASTA HACK!.
Al conectarse le enviamos nuestro key y al ser distinto nos rechaza. Lo que debemos hacer es, borrar la información local que tenemos sobre el host con
$ssh-keygen -R 192.168.1.20
/root/.ssh/known_hosts updated.
Original contents retained as /root/.ssh/known_hosts.old
Y luego volver a generar el key entre las máquinas con una conexión del tipo:
$ ssh -l noc 192.168.1.20The authenticity of host '192.168.1.20 (192.168.1.20)' can't be established.RSA key fingerprint is 3f:3d:a0:bb:59:24:35:6d:e5:a0:1a:3f:9c:86:81:90.Are you sure you want to continue connecting (yes/no)? yes
Con esto quedaría resuelto el problema
lunes, 21 de abril de 2014
Renombre masivo de ficheros con SH
Buenas...
Les adjunto un script que encontré por la web que me resulto muy útil...
Es un script en la shell SH de linux (/bin/sh) que a través de un bucle recorre un sinfin de ficheros en el directorio actual que matchean con la expresion dada y cambia el string fuente por el destino...
Miren...
Espero que les sirva... Saludos! Leer más...
Les adjunto un script que encontré por la web que me resulto muy útil...
Es un script en la shell SH de linux (/bin/sh) que a través de un bucle recorre un sinfin de ficheros en el directorio actual que matchean con la expresion dada y cambia el string fuente por el destino...
Miren...
#!/bin/sh # HEADERS
for i in *.sh; do # Lista ficheros que matcheen con *.sh
j=`echo $i | sed 's/sh/png/'` # (Str) Reemplaza ".sh" por ".png"
mv $i $j # Renombra fichero por texto indicado
done # finalizando el bucle for
Espero que les sirva... Saludos! Leer más...
Suscribirse a:
Entradas (Atom)