12-14-2017
Don't use a while loop - use an if construct.
10 More Discussions You Might Find Interesting
1. Solaris
Hi, I have a Ultra5 440MHz system running Solaris 2.6 (Rev 5.6) and have a problem with the keyboard. When I push a key it prints characters very quickly. If I push a key very fast I get maybe 3 characters.
So, I am thinking bad keyboard. I borrow a known good keyboard, samething and the... (3 Replies)
Discussion started by: mndavies
3 Replies
2. Shell Programming and Scripting
I am trying get "df -k" output from multiple hosts along with their hostnames via ssh, my script is appending the "df -k" output from all the nodes to a single file but not getting the hostnames for those nodes, just wondering how to pass more than one command via ssh or may be someone could come... (6 Replies)
Discussion started by: barkath
6 Replies
3. AIX
Hello. I have an AIX machine at 6100-00.
We had some strange activity since filling up /tmp. One symptom is that who -r displays no output. It doesn't hang just no output is displayed.
We are going to boot the machine, but prior to that I'd like to dig a bit to see what may be causing the... (0 Replies)
Discussion started by: maficdan
0 Replies
4. UNIX for Dummies Questions & Answers
hey, I'm trying to create the command that will create a file named user.txt that contains the output of the command cut -d: -f1,5 /etc/passwd, and displays itself afterwards.
I don't know how to bridge cat > user.txt with cut -d: -f1,5 /etc/passwd, or how display it afterwards. Any help would... (2 Replies)
Discussion started by: raidkridley
2 Replies
5. UNIX for Dummies Questions & Answers
Helllo UNIX Forum :)
Since I am posting on this board, yes, I am new to UNIX!
I read a copy of "UNIX made easy" from 1990, which felt like a making a "computer-science time jump" backwards ;)
So, basically I have some sort of understanding what the basic concept is.
Problem Description:... (6 Replies)
Discussion started by: Kasimir
6 Replies
6. Shell Programming and Scripting
This is for an Oracle journal import. I was using a pl/sql package and oracle API's. Oracle added invoker rights to their API's and now my package won't run. I didn't want to use their API's anyway. The only reason i was using pl/sql and the API's (just a package) was to utilize a cursor. How... (2 Replies)
Discussion started by: lmu
2 Replies
7. Solaris
when i use ls command it works normal but when i using additional parameter with ls like ls -l , ls -a... it shows a error followed by the output.
# ls -l
./hgfs: Operation not applicable
total 12861
-rw-r--r-- 1 root root 0 Jun 1 21:12 1
drwxr-xr-x 2 root root ... (4 Replies)
Discussion started by: chidori
4 Replies
8. Shell Programming and Scripting
I need to print out text from a file in the console up, you know someone like that? (8 Replies)
Discussion started by: gizmo16
8 Replies
9. Shell Programming and Scripting
Hello all! I am writing a script that takes in a directory name as input and if the directory exists, it shows the files inside the directory
here is what I have so far (incomplete) (mostly like pseudocode)
#/bin/sh
echo Please enter the name of a directory
read dir
grep $dir... (2 Replies)
Discussion started by: subway69
2 Replies
10. Shell Programming and Scripting
Hi all,
I want to do an Unix Script to save the 'nmon' output on a text file and I don't know how to do it.
I need a Script for each monitoring and also one to multiple monitorings.
Thanks (6 Replies)
Discussion started by: Javi1990
6 Replies
LEARN ABOUT DEBIAN
text::affixes
Affixes(3pm) User Contributed Perl Documentation Affixes(3pm)
NAME
Text::Affixes - Prefixes and suffixes analisys of text
SYNOPSIS
use Text::Affixes;
my $text = "Hello, world. Hello, big world.";
my $prefixes = get_prefixes($text);
# $prefixes now holds
# {
# 3 => {
# 'Hel' => 2,
# 'wor' => 2,
# }
# }
# or
$prefixes = get_prefixes({min => 1, max => 2},$text);
# $prefixes now holds
# {
# 1 => {
# 'H' => 2,
# 'w' => 2,
# 'b' => 1,
# },
# 2 => {
# 'He' => 2,
# 'wo' => 2,
# 'bi' => 1,
# }
# }
# the use for get_suffixes is similar
DESCRIPTION
Provides methods for prefixe and suffix analisys of text.
METHODS
get_prefixes
Extracts prefixes from text. You can specify the minimum and maximum number of characters of prefixes you want.
Returns a reference to a hash, where the specified limits are mapped in hashes; each of those hashes maps every prefix in the text into the
number of times it was found.
By default, both minimum and maximum limits are 3. If the minimum limit is greater than the lower one, an empty hash is returned.
A prefix is considered to be a sequence of word characters (w) in the beginning of a word (that is, after a word boundary) that does not
reach the end of the word ("regular expressionly", a prefix is the $1 of /(w+)w/).
# extracting prefixes of size 3
$prefixes = get_prefixes( $text );
# extracting prefixes of sizes 2 and 3
$prefixes = get_prefixes( {min => 2}, $text );
# extracting prefixes of sizes 3 and 4
$prefixes = get_prefixes( {max => 4}, $text );
# extracting prefixes of sizes 2, 3 and 4
$prefixes = get_prefixes( {min => 2, max=> 4}, $text);
get_suffixes
The get_suffixes function is similar to the get_prefixes one. You should read the documentation for that one and than come back to this
point.
A suffix is considered to be a sequence of word characters (w) in the end of a word (that is, before a word boundary) that does not start
at the beginning of the word ("regular expressionly" speaking, a prefix is the $1 of /w(w+)/).
# extracting suffixes of size 3
$suffixes = get_suffixes( $text );
# extracting suffixes of sizes 2 and 3
$suffixes = get_suffixes( {min => 2}, $text );
# extracting suffixes of sizes 3 and 4
$suffixes = get_suffixes( {max => 4}, $text );
# extracting suffixes of sizes 2, 3 and 4
$suffixes = get_suffixes( {min => 2, max=> 4}, $text);
OPTIONS
Apart from deciding on a minimum and maximum size for prefixes or suffixes, you can also decide on some configuration options.
exclude_numbers
Set to 0 if you consider numbers as part of words. Default value is 1.
# this
get_suffixes( {min => 1, max => 1, exclude_numbers => 0}, "Hello, but w8" );
# returns this:
{
1 => {
'o' => 1,
't' => 1,
'8' => 1
}
}
lowercase
Set to 1 to extract all prefixes in lowercase mode. Default value is 0.
ATTENTION: This does not mean that prefixes with uppercased characters won't be extracted. It means they will be extracted after being
lowercased.
# this...
get_prefixes( {min => 2, max => 2, lowercase => 1}, "Hello, hello");
# returns this:
{
2 => {
'he' => 2
}
}
TO DO
o Make it more efficient (use C for that)
AUTHOR
Jose Castro, "<cog@cpan.org>"
COPYRIGHT & LICENSE
Copyright 2004 Jose Castro, All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.10.0 2005-11-19 Affixes(3pm)