Sponsored Content
Full Discussion: No puedo borrar un renglon
Top Forums Shell Programming and Scripting No puedo borrar un renglon Post 302468295 by yamirokuay on Tuesday 2nd of November 2010 09:47:13 AM
Old 11-02-2010
No puedo borrar un renglon

#!/bin/sh
# Solo para Argentina :s
# License: Sisterware
# este script necesita curl e iconv, iconv es porque los del servicio meteorologico no usan utf-8 ¬¬
# 87938 = Ushuaia
# 87934 = Rio Grande
# 87418 = Mendoza
# 87582 = Capital Federal
# 87692 = Mar del Plata
# 87480 = Rosario
# 87344 = Cordoba
# 87371 = Santa Fe

# Ciudad predeterminada
ciudad=87938
if [ $# -ge 1 ] ; then
ciudad=$1
fi

URL="http://www.smn.gov.ar/?mod=dpd&id=21&e="$ciudad
TXT="$HOME/Documentos/Pronostico/pronostico.txt"

curl -s "$URL" | grep 'TEMPERATURA: ' | sed -re 's/|&nbsp;|<[a-zA-Z\/][^>]*>| |\t//g' | iconv --from-code=ISO-8859-1 --to-code=UTF-8 > $TXT

#estad=`grep 'ESTADO DEL TIEMPO' $TXT | sed -re 's/.*: (.*)/\1/'`
#visib=`grep 'VISIBILIDAD:' $TXT | sed -re 's/.*: (.*)/\1/'`
#sensa=`grep 'SENSACION:' $TXT | sed -re 's/.*: (.*)/\1/'`
tempe=`grep 'TEMPERATURA:' $TXT | sed -re 's/.*: (.*)/\1/'`
#humed=`grep 'HUMEDAD:' $TXT | sed -re 's/.*: (.*)/\1/'`
#presi=`grep 'PRESION:' $TXT | sed -re 's/.*: (.*)/\1/'`
#vient=`grep 'VIENTO:' $TXT | sed -re 's/.*: (.*)/\1/'`
#hora=`grep '.*Hora:' $TXT | sed -re 's/.*: (.*)Horas\./\1/'`
#dia=`grep '.*Dia:' $TXT | sed -re 's/.*: (.*)/\1/'`

sed 's/'ºC'//g' pronostico.txt > pronosticotmp.txt
sed 's/'TEMPERATURA:'//g' pronosticotmp.txt > temperatura.txt

# Opcional
tempe=`echo $tempe | tr '.' ','`

echo "$tempe ($sensa) - $humed humed. - viento: $vient - presión: $presi - visib: $visib - $estad ($dia $hora)" | sed 's/ / /g'

----------------------------------------------------------------------------------------------------------------
Este script me crea perfectamente los datos que necesito, PERO en el archivo txt me deja un renglon en blanco y no lo puedo borrar.

Desde ya muchas gracias por su ayuda.
 

3 More Discussions You Might Find Interesting

1. Red Hat

Como puedo saber programas esta instalados ?

Hello I am new to linux, I'm doing an inventory software and hardware in a PC version is a Red-Hat and Fedora. How do I can do to know what programs are installed on machines and technical characteristics of the PC (how many gb is the hard disk, amount of RAM and processor)?. From the console. ... (1 Reply)
Discussion started by: john01
1 Replies

2. UNIX for Dummies Questions & Answers

que Borrar en /var/ ?

hola, quisiera saber que puedo borrar del directorio /var/ para liberar espacio en un servidor en debian 4.0? desde ya muchisimas gracias y saludos (2 Replies)
Discussion started by: rodoga
2 Replies

3. UNIX for Dummies Questions & Answers

BORRAR FICHEROS

Hola a todos, tengo varios ficheros core en un directorio: -rw------- 1 all_adm alliance 11043260 May 03 2010 core.610468.03072405 -rw------- 1 all_adm alliance 273221556 Jul 25 05:07 core.893046.25030410 -rw------- 1 all_adm alliance 273212044 Aug 22 01:39 core.692366.21232618... (3 Replies)
Discussion started by: nonanov
3 Replies
ZGREP(1)						      General Commands Manual							  ZGREP(1)

NAME
zgrep - search possibly compressed files for a regular expression SYNOPSIS
zgrep [ grep_options ] [ -e ] pattern filename... DESCRIPTION
Zgrep invokes grep on compressed or gzipped files. These grep options will cause zgrep to terminate with an error code: (-[drRzZ]|--di*|--exc*|--inc*|--rec*|--nu*). All other options specified are passed directly to grep. If no file is specified, then the standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to grep. If the GREP environment variable is set, zgrep uses it as the grep program to be invoked. EXIT CODE
2 - An option that is not supported was specified. AUTHOR
Charles Levert (charles@comm.polymtl.ca) SEE ALSO
grep(1), gzexe(1), gzip(1), zdiff(1), zforce(1), zmore(1), znew(1) ZGREP(1)
All times are GMT -4. The time now is 04:04 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy