The UNIX and Linux Forums  

Go Back   El UNIX y Linux Foros > Arriba Foros > Programación de scripts de shell y
.
google unix.com



Programación de scripts de shell y Plantear preguntas sobre KSH, CSH, SH, BASH, PERL, PHP, SED, AWK y otros scripts de shell y lenguajes de script de shell aquí.

Más UNIX y Linux Foro Temas usted puede encontrar útiles
Hilo Hilo para principiantes Foro Respuestas Último mensaje
sed escapar char fed.linuxgossip Programación de scripts de shell y 2 10-04-2008 07:41 AM
Cómo reemplazar cualquier char con carácter de nueva línea. mightysam Programación de scripts de shell y 5 09-18-2008 09:15 PM
char c \u003d 882 useless79 Programación de Alto Nivel 1 07-30-2007 06:16 AM
char * p p char y []. arunviswanath Programación de Alto Nivel 4 07-20-2006 03:11 AM
\ n char en C C | [antitrust] Programación de Alto Nivel 1 05-05-2005 07:15 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
Linkback vínculo Herramientas de hilo Buscar en este Hilo Tasa de Hilo Modos de visualización
  #1 (Enlace permanente)  
Old 11-20-2008
hibern hibern is offline
Usuario Registrado
  
 

Fecha: noviembre 2008
Publicaciones: 3
Question sed extraña con cuestiones de carácter

Hola a todos,

Intento crear un script de shell que tenía la etiqueta de XiTi al final de las páginas web servals justo antes de la etiqueta <body/>.

aquí está mi script:

Código:
#!/bin/bash
##################################################################


rm -R /home/hibern/TEMP/hibern
cp -R /home/hibern/TEMP/hibernorig /home/hibern/TEMP/hibern
value=0

cat << EOF > /tmp/xiti.tmp
<!--\
Xt_param = 's=279747&p=';\
try {Xt_r = top.document.referrer;}\
catch(e) {Xt_r = document.referrer; }\
Xt_h = new Date();\
Xt_i = '<img width="39" height="25" border="0" alt="" ';\
Xt_i += 'src="http://logv33.xiti.com/hit.xiti?'+Xt_param;\
Xt_i += '&hl='+Xt_h.getHours()+'x'+Xt_h.getMinutes()+'x'+Xt_h.getSeconds();\
if(parseFloat(navigator.appVersion)>=4)\
{Xt_s=screen;Xt_i+='&r='+Xt_s.width+'x'+Xt_s.height+'x'+Xt_s.pixelDepth+'x'+Xt_s.colorDepth;}\
document.write(Xt_i+'&ref='+Xt_r.replace(/[<>"]/g, '').replace(/&/g, '$')+'" title="Internet Audience">');\
//-->\
</script>\
<noscript>\
Mesure d'audience ROI statistique webanalytics par <img width="39" height="25" src="http://logv33.xiti.com/hit.xiti?s=279747&p=" alt="WebAnalytics" />\
</noscript></a>\
EOF

for file in `find  /home/hibern/TEMP/hibern -name '*.html' -print`
do

export m_tag=`cat /tmp/xiti.tmp`

sed -e 's/<body>/'$m_tag'/g' "$file" > "$file".tmp && mv -f "$file".tmp "$file"
done
y aquí está mi error :-(

Código:
sed: -e expression #1, char 39: unterminated `s' command
gracias de antemano por su ayuda
  #2 (Enlace permanente)  
Old 11-20-2008
jlliagre jlliagre is online now Forum Advisor  
sıɹɐlosuǝdo ɹǝsn
  
 

Fecha: diciembre 2007
Ubicación: París
Mensajes: 1.444
Prueba:
Código:
sed -e 's/<body>/'"$m_tag"'/g' "$file" > "$file".tmp && mv -f "$file".tmp "$file"
  #3 (Enlace permanente)  
Old 11-21-2008
mailme0712 mailme0712 is offline
Usuario Registrado
  
 

Fecha: Sep 2008
Ubicación: Chennai, India
Publicaciones: 13
Arrow

Hola,

Marque esta

sed -e 's / <body> / $ (m_tag) / g' "$ archivo"> "$ archivo". tmp & & mv-f "$ fichero". tmp "$ archivo"




Gracias,

Thangaraju
  #4 (Enlace permanente)  
Old 11-21-2008
vino's Avatar
vino vino is offline Forum Staff  
Defensor (in vino veritas)
  
 

Fecha: febrero 2005
Lugar: Bangalore, India
Mensajes: 2.798
Código:
sed -e "s/<body>/${m_tag}/g" "$file" > "$file".tmp && mv -f "$file".tmp "$file"
Excluir todas las comillas simples y dobles uso. Recuerde, la única cita a desactivar el parámetro de expansión. Véase el siguiente

Código:
[/tmp]$ a='some text'
[/tmp]$ echo $a
some text
[/tmp]$ echo '$a'
$a
[/tmp]$ echo "$a"
some text
  #5 (Enlace permanente)  
Old 11-21-2008
hibern hibern is offline
Usuario Registrado
  
 

Fecha: noviembre 2008
Publicaciones: 3
Gracias por su respuesta, pero no funciona :-(

He intentado línea por línea y la i que esto se debe a (char. (que para algunas cosas, como una macro)

he intentado con \ (pero todavía su problème :-(
  #6 (Enlace permanente)  
Old 11-23-2008
hibern hibern is offline
Usuario Registrado
  
 

Fecha: noviembre 2008
Publicaciones: 3
Thumbs up Solucionado

Gracias por su ayuda, mi problema se soluciona, aquí está el código:

Cita:
#! / bin / bash
################################################## ################

rm-R / home / hibern / temp / hibern
cp-R / home / hibern / temp / hibernorig / home / hibern / temp / hibern
cat <<EOF> / tmp / xiti.tmp
<! - \
Xt_param \u003d 's \u003d 279747 & p \u003d'; \
try (Xt_r \u003d top.document.referrer;) \
de capturas (e) (Xt_r \u003d document.referrer;) \
Xt_h \u003d new Fecha (); \
Xt_i \u003d \ '<img width \u003d "39" height \u003d "25" border \u003d "0" alt \u003d "" \', \
Xt_i + \u003d \ "src \u003d" http: \ / \ / logv33.xiti.com \ / hit.xiti? \ '+ Xt_param; \
Xt_i + \u003d \ '\ & hl \u003d \' Xt_h.getHours + () + \ 'x \' Xt_h.getMinutes + () + \ 'x \' + Xt_h.getSeconds (); \
if (parseFloat (navigator.appVersion)> \u003d 4) \
\u003d (Xt_s pantalla; Xt_i + \u003d \ '\ & r \u003d' + Xt_s.width + \ 'x \' Xt_s.height + + \ 'x \' Xt_s.pixelDepth + + \ 'x \' + Xt_s.colorDepth;) \
document.write (Xt_i + \ '\ & ref \u003d' + Xt_r.replace (\ /[<>"] \ / g, \ '\'). reemplazar (\ / & \ / g, \ '$ \') + ' "title \u003d" Audiencia de Internet ">'); \
\ / \ / -> \
<\ / script> \
<noscript> \
Mesure d'audience ROI statistique webanalytics par <img width \u003d "39" height \u003d "25" src \u003d "http: \ / \ / logv33.xiti.com \ / hit.xiti? S \u003d 279747 & p \u003d" \ alt \u003d "WebAnalytics "\ /> \
<\ / noscript> <\ / a> <\ / body>
EF
exportación m_tag \u003d `cat / tmp / xiti.tmp»
echo "Valor para m_tag:" $ m_tag
para encontrar el archivo en `/ home / hibern / temp / hibern-name '*. html'-print`
hacer
#sed -e 's / <body\/> /' "$ m_tag" '/ g' "$ archivo"> "$ archivo". tmp & & mv-f "$ fichero". tmp "$ archivo"
sed -e 's / <\ / body> / \' "$ m_tag" '/ g' "$ archivo"> "$ archivo". tmp & & mv-f "$ fichero". tmp "$ archivo"
hecho
Closed Thread

Marcadores

Etiquetas
sed XiTi, script de shell, de secuencias de comandos de shell, de secuencias de comandos de Unix, bases de secuencias de comandos de Unix

Herramientas de hilo Buscar en este Hilo
Buscar en este Hilo:

Búsqueda avanzada
Modos de visualización Vota a este hilo
Vota a este hilo:

Normas de envío
puede que no nuevo puesto de hilos
puede que no enviar respuestas
puede que no enviar archivos adjuntos
puede que no editar sus puestos

Código BB es Encendido
Emoticones son Encendido
[IMG] código Encendido
Código HTML es Apagado
Trackbacks son Encendido
Pingbacks son Encendido
Refbacks son Encendido




Todas las horas son GMT -4. La hora es 11:40 PM.


Powered by: vBulletin, Copyright © 2000 - 2006, Jelsoft Enterprises Limited. Traducciones de idiomas Powered by .
vBCredits v1.4 Copyright © 2007 - 2008, PixelFX Estudios
El UNIX y Linux Foros Contenido Copyright © 1993-2009. Todos los derechos Reserved.Ad Gestión por RedTyger

Las direcciones URL de contenido vBSEO 3.2.0