Sponsored Content
Homework and Emergencies Homework & Coursework Questions Fortran: Search value in array Post 302701901 by bakunin on Monday 17th of September 2012 01:12:40 PM
Old 09-17-2012
Quote:
Originally Posted by timewilltell
i got little confused... how to " For every line you break the line up into lookup values for the array " ???
You read each line of data1. For every line read that way you do:

- break the line at the spaces to get the numbers. For instance:

Code:
8 2 1 5 7 9

-> break at space chars, you get 6 numbers:

Code:
8
2
1
5
7
9

- loop through these numbers left to right (top to bottom), looking up the numbers as values in your first array.

If you know C, have a look at the library function strtok(). You will have to do the same in FORTRAN.

I hope this helps.

bakunin
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

search of string from an array in Perl

Hi All I want to search a string from an array in Perl. If a match occurs, assign that string to a variable else assign 'No match'. I tried writing the script as follows but it's in vain. Please help me.. #!/usr/bin/perl use strict; my $NER; my @text=("ORG","PER"); ... (4 Replies)
Discussion started by: my_Perl
4 Replies

2. Shell Programming and Scripting

PHP: Search Multi-Dimensional(nested) array and export values of currenly worked on array.

Hi All, I'm writing a nagios check that will see if our ldap servers are in sync... I got the status data into a nested array, I would like to search key of each array and if "OK" is NOT present, echo other key=>values in the current array to a variable so...eg...let take the single array... (1 Reply)
Discussion started by: zeekblack
1 Replies

3. UNIX for Dummies Questions & Answers

search a value in array

Hi, I am just writing a program to check a value in the given array. The program expects a parameter which is checked against the array list and if it found then a variable is set else should exist saying the value does is not found in the array.kindly help me. (4 Replies)
Discussion started by: pals70423
4 Replies

4. Shell Programming and Scripting

how to search array and print index in ksh

Hi, I am using KSH shell to do some programming. I want to search array and print index value of the array. Example.. nodeval4workflow="DESCRIPTION ="" ISENABLED ="YES" ISVALID ="YES" NAME="TESTVALIDATION" set -A strwfVar $nodeval4workflow strwfVar=DESCRIPTION=""... (1 Reply)
Discussion started by: tmalik79
1 Replies

5. Shell Programming and Scripting

awk search strings from array in textfile

I am wanting to take a list of strings and loop through a list of textfiles to find matches. Preferably with awk and parsing the search strings into an array. // Search_strings.txt tag string dummy stuff things // List of files to search in textfile1.txt textfile2.txt The... (6 Replies)
Discussion started by: sdf
6 Replies

6. Shell Programming and Scripting

Search strings from array in second file

I have a file search_strings.txt filled with search strings which have a blank in between and look like this: S. g. Erh. o. J. v. d. Chijs g. Ehr.I would like to search the strings in the second given Textfile.txt and it shall return the column number. Can anybody help with the correct... (3 Replies)
Discussion started by: sdf
3 Replies

7. Shell Programming and Scripting

Search an array and return index (bash)

Hi all, In bash, is there any way of searching an array and returning the index? For example, how could I write a script that would do the following: >> search note_array=(C D E F G A B) for F return the value 3 (or 4) Thanks, R (5 Replies)
Discussion started by: RMontenegro
5 Replies

8. UNIX for Dummies Questions & Answers

Fortran: Search value in array

hi i have two data sets one(data1) containing 3 8 2 1 5 7 9 9 2 2 5 7 7 10 3 6 6 6 6 and other(data2) containing 5 1 10 5 20 7 30 6 40 9 50 now i want my program to search the values 1 5 7 9 from (data1) in data 2 column 1 and then take the average of the corresoinding... (1 Reply)
Discussion started by: timewilltell
1 Replies

9. Shell Programming and Scripting

Perl - use search keywords from array and search a file and print 3rd field when matched

Hi , I have been trying to write a perl script to do this job. But i am not able to achieve the desired result. Below is my code. my $current_value=12345; my @users=("bob","ben","tom","harry"); open DBLIST,"<","/var/tmp/DBinfo"; my @input = <DBLIST>; foreach (@users) { my... (11 Replies)
Discussion started by: chidori
11 Replies

10. UNIX for Advanced & Expert Users

Search and replace a array values in perl

Hi, i want to search and replace array values by using perl perl -pi -e "s/${d$i]}/${b$j]}" *.xml i am using while loop for the same. if i excute this,it shows "Substitution replacement not terminated at -e line 1.". please tell me what's wrong this line (1 Reply)
Discussion started by: arindam guha
1 Replies
MicroMason::TemplatePath(3pm)				User Contributed Perl Documentation			     MicroMason::TemplatePath(3pm)

NAME
Text::MicroMason::TemplatePath - Template Path Searching SYNOPSIS
Instead of using this class directly, pass its name to be mixed in: use Text::MicroMason; my $mason = Text::MicroMason->new( -TemplatePath, template_path => [ '/foo', '/bar' ] ); Use the standard compile and execute methods to parse and evalute templates: print $mason->compile( file=>$filepath )->( 'name'=>'Dave' ); print $mason->execute( file=>$filepath, 'name'=>'Dave' ); Templates stored in files are searched for in the specified template_path: print $mason->execute( file=>"includes/greeting.msn", 'name'=>'Charles'); When including other files into a template you can use relative paths: <& ../includes/greeting.msn, name => 'Alice' &> When a file is included in the template, the including template's current directory is added to the beginning of the template search path. DESCRIPTION
This module works similarly to the related TemplateDir mix-in. However, instead of specifying a single root which must contain all templates, TemplatePath allows you to specify an arrayref of directories which will be searched in order whenever a template filename must be resolved. Using a TemplatePath object, absolute filenames are used as-is. If a relative template filenames or file paths is used, every directory in the specified template_path is checked for the existence of the template, and the first existing template file is used. If a template includes another template using <& ... &>, then the including template's location is added to the beginning of the template search path list, for the resolution of the included template's filename. This allows the included template to be specified relative to the including template, but also lets the template search fall back to the configured template search path if necessary. Supported Attributes template_path An array ref containing a list of directories in which to search for relative template filenames. strict_root Optional directory beyond which not to read files. Unlike TemplateDir, this must be a specific file path. Causes read_file to croak if any filename outside of the root is provided. You should make sure that all paths specified in template_path are inside the specified strict_root. (Note that this is not a chroot jail and only affects attempts to load a file as a template; for greater security see the chroot() builtin and Text::MicroMason::Safe.) Private Methods read_file Intercepts file access to check for strict_root. EXCEPTIONS The following additional exceptions are generated by Text::MicroMason::TemplatePath when appropriate: o Text::MicroMason::TemplatePath: template '%s' not found in path. This indicates that the specified template name does not exist in any of the directories in the configured path. o Text::MicroMason::TemplatePath: Template not in required base path '%s' The template found in the configured template path was not within the configured strict_root directory. This may be caused by requesting an absolute template filename not within strict_root, or by specifying a strict_root which does not match the configured template path. SEE ALSO
For an overview of this templating framework, see Text::MicroMason. This is a mixin class intended for use with Text::MicroMason::Base. For distribution, installation, support, copyright and license information, see Text::MicroMason::Docs::ReadMe. perl v5.10.1 2009-10-27 MicroMason::TemplatePath(3pm)
All times are GMT -4. The time now is 09:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy