Sponsored Content
Top Forums Shell Programming and Scripting How to use shell script's to get EPG Program with SED Post 302144160 by single on Tuesday 6th of November 2007 01:08:02 PM
Old 11-06-2007
Tools How to use shell script's to get EPG Program with SED

This is my test script version:

Code:
#!/bin/sh
wget -q -O /tmp/axn 'http://www.axn.pt/programacion/'
sed -e '/^$/ d' /tmp/axn > /tmp/temp     #Clean black space

sed -e 's/<[^>]*>//g' /tmp/temp > /tmp/temp1  #Remove HTML
rm -f /tmp/temp    # Step by step script then clean one by one
sed 's/>[    ]*</></g'  /tmp/temp1 > /tmp/temp2
#
rm -f /tmp/temp1
sed -e '/^$/ d' /tmp/temp2 > /tmp/temp3     #Clean empty space
rm -f /tmp/temp2
sed -n '102,130p' /tmp/temp3 > /tmp/temp4 # Print line 102 to 103
rm -f /tmp/temp3
sed -e '/^$/ d' /tmp/temp4 > /tmp/temp5     #Clean empty space
rm -f /tmp/temp4
sed 's/^\([0-9][0-9]:[0-9][0-9]\)/\n\1/g' /tmp/temp5 > /tmp/temp6
rm -f /tmp/temp5
sed -e 's/&.*;//g' /tmp/temp6 > /tmp/temp7
rm -f /tmp/temp6
cat /tmp/temp7  # Show temp7
fi

and the result is this:

Code:
Manhã
                
        06:26C.S.I. Nova Iorque07:10Hospital Central08:33Sem Rasto09:20Stingers: Infiltrados10:15C.S.I. Nova Iorque11:05Hospital Central12:30C.S.I. Miami13:25Asas nos Pés14:15Medium

This is the Programs of this channel, this channel have no EPG on it, then using internet i can go to that web pag. and grab the "EPG"

Well the problem is that is not what i have in mind is something like this:
Code:
Manhã               
06:26 C.S.I. Nova Iorque
07:10 Hospital Central
08:33 Sem Rasto
09:20 Stingers: Infiltrados
10:15 C.S.I. Nova Iorque
11:05 Hospital Central
12:30 C.S.I. Miami
13:25 Asas nos Pés
14:15 Medium

Smilie

Another think this is not to be used in a PC but in STB Linux based.


Maby a xml aproch will be better, any ideas?
 

10 More Discussions You Might Find Interesting

1. Filesystems, Disks and Memory

shell script program

shell script for sorting,searchingand insertion/deletion of elements in a list (1 Reply)
Discussion started by: jayaram_miryabb
1 Replies

2. Shell Programming and Scripting

How to use sed within shell program?

Hi, I tried this with my shell program and it didn't work: /usr/ucb/sed '/$employeeID/d' /usr1/log/logfile How to let sed see my variable employeeID within my shell program? Thanks! (1 Reply)
Discussion started by: whatisthis
1 Replies

3. Shell Programming and Scripting

Need help on C-shell script program

#!/bin/csh # This program will add integers # # # add integer1 .. # # Check for argument if ($#argv == 0 ) then echo "usage: add integers" exit 1 else set input = $argv endif # set sum = 0 foreach var ( $input ) @sum = $sum + $input end # (1 Reply)
Discussion started by: haze21
1 Replies

4. Shell Programming and Scripting

please convert the below program into shell script

if ( ( grep -i "Exception : " /home/dklog* )) then echo " improper combination" elsif ( ( grep -i "invalid" /home/dklog*)) then echo " wrong process " fi fi in the above case i am facing the the syntx error please help in this case... (3 Replies)
Discussion started by: mail2sant
3 Replies

5. Shell Programming and Scripting

Call C Program From Shell Script

Hi, Could anybody please let me know how to call a C_Program from shell script. I know through command "system" we can call shell script from C program. Awaiting response. Thanks and regards, Chanakya M (4 Replies)
Discussion started by: Chanakya.m
4 Replies

6. Shell Programming and Scripting

C program to execute shell script

Hi, Can anyone pls give a sample to execute a shell script from C program Thanks (2 Replies)
Discussion started by: baigmd
2 Replies

7. Shell Programming and Scripting

shell program with sed

I want to substitute a charactor "PAN" with "TAN" in a shell, I used sed command in shell, it wo'nt work but the same is run from command prompt it was successful. the command is sed ' s/PAN/TAN/g ' <i/p> > <o/p> sed ' s/^M/^M/g ' <i/p> > <o/p> (1st ^M is Ctrl+V+M, 2nd should be line feed/next... (1 Reply)
Discussion started by: anil_kut
1 Replies

8. Shell Programming and Scripting

shell script program

shell script in Unix/Linux to find the lines numbers of a text file are having word which is 5 to 10 characters long and having first letter as a capital letter. (3 Replies)
Discussion started by: usersnehal
3 Replies

9. Homework & Coursework Questions

Need help writing a shell script program

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Write the a shell script program to remove all space characters stored in the shell variable TEXT.... (7 Replies)
Discussion started by: kofine05
7 Replies

10. Shell Programming and Scripting

Controlling a program from shell script

Hi all, I am trying to write a shell script that starts a program, reads from its stdout and can write to its stdin. I'm having trouble to get it to work, I tried using named pipes, and using exec and file descriptors. Just couldn't get it to work, so I thought I'll post it here to see if... (4 Replies)
Discussion started by: test it
4 Replies
CHECKBASHISMS(1)					      General Commands Manual						  CHECKBASHISMS(1)

NAME
checkbashisms - check for bashisms in /bin/sh scripts SYNOPSIS
checkbashisms script ... checkbashisms --help|--version DESCRIPTION
checkbashisms, based on one of the checks from the lintian system, performs basic checks on /bin/sh shell scripts for the possible presence of bashisms. It takes the names of the shell scripts on the command line, and outputs warnings if possible bashisms are detected. Note that the definition of a bashism in this context roughly equates to "a shell feature that is not required to be supported by POSIX"; this means that some issues flagged may be permitted under optional sections of POSIX, such as XSI or User Portability. In cases where POSIX and Debian Policy disagree, checkbashisms by default allows extensions permitted by Policy but may also provide options for stricter checking. OPTIONS
--help, -h Show a summary of options. --newline, -n Check for "echo -n" usage (non POSIX but required by Debian Policy 10.4.) --posix, -p Check for issues which are non POSIX but required to be supported by Debian Policy 10.4 (implies -n). --force, -f Force each script to be checked, even if it would normally not be (for instance, it has a bash or non POSIX shell shebang or appears to be a shell wrapper). --extra, -x Highlight lines which, whilst they do not contain bashisms, may be useful in determining whether a particular issue is a false posi- tive which may be ignored. For example, the use of "$BASH_ENV" may be preceded by checking whether "$BASH" is set. --version, -v Show version and copyright information. EXIT VALUES
The exit value will be 0 if no possible bashisms or other problems were detected. Otherwise it will be the sum of the following error val- ues: 1 A possible bashism was detected. 2 A file was skipped for some reason, for example, because it was unreadable or not found. The warning message will give details. SEE ALSO
lintian(1). AUTHOR
checkbashisms was originally written as a shell script by Yann Dirson <dirson@debian.org> and rewritten in Perl with many more features by Julian Gilbey <jdg@debian.org>. DEBIAN
Debian Utilities CHECKBASHISMS(1)
All times are GMT -4. The time now is 09:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy