Sponsored Content
Top Forums Shell Programming and Scripting Bash: Reading out rows of a file into a dynamic array and check first literal Post 302339875 by ABE2202 on Friday 31st of July 2009 03:33:16 PM
Old 07-31-2009
I want to read out ALL appearances of the string 'Movie' and check whether they ALL beginn with a '*'. So I think I need an array with a DYNAMIC number of fields since they number of 'Movie'-string varies.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Is there any commands to check the dynamic changes of a file

Hi guys i had a script which will generate a log file.Is there any commands to check the dynamic changes in the log file,i.e if i open the log file i should able to see the updating changes live...I hope u understand my query... (2 Replies)
Discussion started by: vinoo
2 Replies

2. Programming

Creating an array to hold posix thread ids: Only dynamic array works

I am facing a strange error while creating posix threads: Given below are two snippets of code, the first one works whereas the second one gives a garbage value in the output. Snippet 1 This works: -------------- int *threadids; threadids = (int *) malloc (num_threads * sizeof(int)); ... (4 Replies)
Discussion started by: kmehta
4 Replies

3. UNIX for Dummies Questions & Answers

Reading a file into an array

I have a file that is a text file, how to get all the words into and array, i am able to get each line but not each word :(. Here is what i searched and already found...https://www.unix.com/shell-programming-scripting/99207-pipe-text-file-into-array.html. This one reads a whole line into... (6 Replies)
Discussion started by: SasankaBITS
6 Replies

4. Shell Programming and Scripting

Reading from a file and assigning to an array in perl

I wrote a simply perl that searched a file for a particualr value and if it found it, rite it and the next three lines to a file. Now I have been asked to check those next three lines for a different value and only write those lines if it finds the second value. I was thinking the best way to... (1 Reply)
Discussion started by: billprice13
1 Replies

5. Shell Programming and Scripting

reading data from a file to an array

I need some help with this code below, i doesnt know why it will run twice with my function, but my function only got if else, any other way that can read line and put into array? while read line; do read -A array <<<$line n=${#array} for ((i=1;i<$n;i++)); do print... (1 Reply)
Discussion started by: gavin_L
1 Replies

6. Shell Programming and Scripting

Reading a file into array

Hi, I need to read a file into array and print them in a loop:- 1st file :-cat a.txt RC1 RC2 RC3 RC4 My Program:- #!/bin/ksh index=0 while do read cnt<a.txt print "cnt value is ${cnt} index=`expr $index + 1` done Code tags for code, please. (5 Replies)
Discussion started by: satishmallidi
5 Replies

7. Shell Programming and Scripting

Reading a file into an array

Hi I have a file with contents as below : server | ABC Issue : File System Missing XYZ Issue : Wrong Syntax PQR Issue : Old File to be removed Now I am looking for an o/p similar to server <tab> ABC Issue : File System Missing <tab> XYZ Issue : Wrong Syntax <tab>... (4 Replies)
Discussion started by: deo_kaustubh
4 Replies

8. Shell Programming and Scripting

Help w/ Reading Matrix & Storing in dynamic array

First of I would just like to state that I am not looking for you guys to just do my work for me, I do want to learn and actually understand everything that is happening. Hey all, I am having trouble on this. What I need to do is... Write an executable C file that will take a text file (not a... (8 Replies)
Discussion started by: innvert
8 Replies

9. Shell Programming and Scripting

Reading a long literal continued next line

I am trying to identify all messages or prompts from a number of COBOL programs and they can usually be identified by a pair of double quotes on one line. However, sometimes the literal will not be finished on the first line but after a dash in column 7 of the next line, the literal will be... (6 Replies)
Discussion started by: wbport
6 Replies

10. UNIX for Dummies Questions & Answers

Check for empty line at end of a dynamic header in each file

Hi Folks, I have a requirement to develop a shell script. PFB my requirement, Requirement: I need to check an empty line after the end of each header in respective file and if a empty line is present simply echo file OK and if empty line is not present echo "Adding empty line" and add an... (6 Replies)
Discussion started by: tpk
6 Replies
TV_IMDB(1p)						User Contributed Perl Documentation					       TV_IMDB(1p)

NAME
tv_imdb - Augment XMLTV listings files with imdb.com data. SYNOPSIS
tv_imdb --imdbdir <dir> [--help] [--quiet] [--download] [--prepStage (1-7,all)] tv_imdb --imdbdir <dir> [--help] [--quiet] [--movies-only][--stats][--output FILE] [FILE...] DESCRIPTION
Very similar to tv_cat in symantics (see tv_cat) except whenever a programme appears with "date" entry the title and date are used to look up extra data by using the XMLTV::IMDB package. --output FILE write to FILE rather than standard output --quiet disable all status messages (that normally appear on stderr). --download try to download data files if they are missing (in --prepStage). --stats force output of grab stats (stats output disabled in --quiet mode). --movies-only only augment programs that look like movie listings (4 digit 'date' field). All programs are checked against imdb.com data (unless --movies-only is used). For the purposes of tv_imdb, an "exact" match is defined as a case insensitive match gainst imdb.com data (which may or may not include the transformation of '&' to 'and' and vise-versa. If the program includes a 4 digit 'date' field the following is matches are attempted, the first succeeding match is used: 1. an "exact" title/year match against movie titles is done 2. an "exact" title match against tv series (and tv mini series) 3. an "exact" title match against movie titles with production dates within 2 years of the 'date' value. Unless --movies-only is used, if the program does not include a 4 digit 'date' field the following matches are attempted, the first succeeding match is used: 1. an "exact" title match against tv series (and tv mini series) When a match is found in the imdb.com data the following is applied: 1. the 'title' field is set to match exactly the title from the imdb.com data. This includes modification of the case to match and any transformations mentioned above. 2. if the match is a movie, the 'date' field is set to imdb.com 4 digit year of production. 3. the type of match found (Movie, TV Movie, Video Movie, TV Series, or TV Mini Series) is placed in the 'categories' field. 4. the url to the www.imdb.com page is added 5. the director is added if the match was a movie or if only one director is listed in the imdb.com data (because some tv series have > 30 directors) 6. the top 3 billing actors are added. 7. genres added to 'categories' field (current list of genres are Short, Drama, Comedy, Documentary, Animation, Adult, Action, Family, Romance, Crime, Thriller, Musical, Adventure, Western, Horror, Sci-Fi, Fantasy, Mystery, War, Film-Noir, Music 8. imdb user ratings added to 'star-ratings' field. HOWTO In order to use tv_imdb, you need: 1. choose a directory location to use for the tv_imdb database (you'll need about 1/2 GB of free space), 2a. run 'tv_imdb --imdbdir <dir> --prepStage all --download' to download the list files from imdb.com. Or, 2b If you have a slow network connection you may prefer to omit the '--download' flag and be prompted for what you need to download by hand. See <http://www.imdb.com/interfaces> for the download sites. Then once you have the files rerun without '--download'. Note: '--prepStage' sucks a bit of memeory, but you can run each prepStage separately by running --prepStage with each of the stages (see --help for details). 3. Once you have the database loaded try 'cat tv.xml | tv_imdb --imdbdir <dir> > tv1.xml'. Feel free to report any problems with these steps to xmltv-devel@lists.sf.net. BUGS
The '--prepStage' needs a lot of memory to run at a reasonable speed, over 200 megabytes with the current imdb data files. For there to be 200 megabytes free for tv_imdb, the system will need at least 256 megabytes of RAM. Running with less can take hours (or days!) - although fortunately this stage needs to be run only once after downloading the data files. Could use a --configure step just like the grabbers so you do not have to specify the --imdbdir on the command line every time. Also this could step you through the prep stages with more description of what is being done and what is required. Configure could also control the number of actors to add (since some movies have an awful lot), currently we are adding the top 3. How and what to look up needs to be option driven. Needs some more controls for fine tuning "close" matches. For instance, currently it looks like the North America grabber only has date entries for movies, but the imdb.com data contains made for video movies as well as as real movies, ot is it's possible to get the wrong data to be inserted. In this case we may want to say "ignore tv series" and "ignore tv mini series". Along with this, we'd want to define what a "close" match is. For instance does a movie by the same title with a date out by 1 year or 2 years considered a match (currently we're using 2). Nice to haves include: verification/addition of programe MPAA/VCHIP ratings, addition of imdb.com user ratings (by votes) to programes. Potenially we could expand to include "country of origin", "description", "writer" and "producer" credits, maybe even "commentator". Heh, if the XMLTV.dtd supported it, we could even include urls to head shots of the actors :) SEE ALSO
xmltv(5) AUTHOR
Jerry Veldhuis, jerry@matilda.com perl v5.14.2 2011-06-22 TV_IMDB(1p)
All times are GMT -4. The time now is 09:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy