Sponsored Content
Top Forums Shell Programming and Scripting A little help using grep for anagram solving with BASH Post 302332308 by Perderabo on Wednesday 8th of July 2009 04:51:32 PM
Old 07-08-2009
Stuff like this worries me. It might be homework. Or it might just be a private exercize. Smilie Well I'll take a chance. Here is one solution...
Code:
$ cat bashtest
#! /bin/bash
x=abcdefg
eval letters=( $(echo $x | sed 's/./& /g') )
exec < candidates
while read candidate ; do
        temp=$candidate
        for((k=0; ${#letters[@]}>k; k++ )) ; do
                temp=${temp/${letters[k]}/}
                [[ -z $temp ]] && echo $candidate
        done
done
exit 0
$
$
$
$
$ cat candidates
abcdefg
axbcdef
cgfaebd
$
$
$
$
$ ./bashtest
abcdefg
cgfaebd
$

 

6 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Solving the network collisions in Unix box

Hi, Anyone can u give me an idea to clear the network collisions in the unix box(Solaris and Linux)? NIC performance is very low, and it shows collisions, when issuing the command ifconfig -a in the production server. How can i rectify the network collisions in the box. Using netstat and lsof... (4 Replies)
Discussion started by: muthulingaraja
4 Replies

2. Shell Programming and Scripting

Lay person needs perl help solving error message

Hi, My name is Tex I am past 60 and in need of perl help. My hobby is genealogy and I am using a perl program to display my data on my web pages. I don't even know enough to know how to ask in the right way for the help I need. This program is written in perl it is open and has been updated... (2 Replies)
Discussion started by: tex
2 Replies

3. UNIX for Dummies Questions & Answers

Bash - CLI - grep - Passing result to grep through pipe

Hello. I want to get all modules which are loaded and which name are exactly 2 characters long and not more than 2 characters and begin with "nv" lsmod | (e)grep '^nv???????????? I want to get all modules which are loaded and which name begin with "nv" and are 2 to 7 characters long ... (1 Reply)
Discussion started by: jcdole
1 Replies

4. Homework & Coursework Questions

Solving heat equation using crank-nicolsan scheme in FORTRAN

! The one-dimensional PDE for heat diffusion equation ! u_t=(D(u)u_x)_x + s where u(x,t) is the temperature, ! D(u) is the diffusivity and s(x,t) is a source term. ! Taking D(u)= 1 and s(x,t)=0 gives ! u_t= u_xx ! uniform one dimensional region |x|<1 for t>0 ! uniform mesh size delta x=0.1 !... (1 Reply)
Discussion started by: watto1
1 Replies

5. Shell Programming and Scripting

Anagram finder based in Ascii values

Hello, i need some help with a programm i want to make, what i want to do is to make a dictionary and include some anagrams with it, and make the programm read the Ascii value of each word, and compare them with the anagrams and make the programm print the words that have the same Ascii value,... (1 Reply)
Discussion started by: jose2802
1 Replies

6. Shell Programming and Scripting

Shell script for solving the math question

Can such Puzzle solve through UNIX script? if yes, what could be the code? This has been solve in C language. we were trying to solve this through shell but could not because of not able to pass 1st argument with multiple value. we are not expert in unix scripting. Below is the puzzle John is a... (4 Replies)
Discussion started by: anshu ranjan
4 Replies
FANN_GET_CASCADE_CANDIDATE_STAGNATION_EPOCHS(3) 			 1			   FANN_GET_CASCADE_CANDIDATE_STAGNATION_EPOCHS(3)

fann_get_cascade_candidate_stagnation_epochs - Returns the number of cascade candidate stagnation epochs

SYNOPSIS
float fann_get_cascade_candidate_stagnation_epochs (resource $ann) DESCRIPTION
The number of cascade candidate stagnation epochs determines the number of epochs training is allowed to continue without changing the MSE by a fraction of fann_get_cascade_candidate_change_fraction(3). See more info about this parameter in fann_get_cascade_candidate_change_fraction(3). The default number of cascade candidate stagnation epochs is 12. PARAMETERS
o $ann -Neural network resource. RETURN VALUES
The number of cascade candidate stagnation epochs, or FALSE on error. SEE ALSO
fann_set_cascade_candidate_stagnation_epochs(3), fann_get_cascade_candidate_change_fraction(3). PHP Documentation Group FANN_GET_CASCADE_CANDIDATE_STAGNATION_EPOCHS(3)
All times are GMT -4. The time now is 05:40 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy