If you're using GNU find, you can use the -regex option:
If you don't have GNU find, you can use egrep:
Note the slight difference between the grep and find regexes. Find assumes the regex should match the entire line. For grep we only need to tell it to match the extension, and append $ to the end to tell it that must be at the end of the line to match.
These 2 Users Gave Thanks to Corona688 For This Post:
There are these ksh files and config files that are written and updated on a daily basis.
All I want to do is write a script that finds both these types of files and archive them on a daily basis, to help in restoring in times of system outages and so on. Particulary I'm interested in .ksh ,... (9 Replies)
I need to find whether there is a file named vijay is there or not in folder named "opt" .I tried "ls *|grep vijay" but it showed permission problem.
so i need to use find command (6 Replies)
Hi all
i need your help .. I am having a multiple file in directory and i have find out the Rcopy word from these files and need to print those files which contains the Rcopy word
Thanks and regards
Vijay sahu (2 Replies)
How can I pass $var_find variable as argment to find command?
test.sh
var_find=' \( -name "*.xml" -o -name "*.jsp" \) '
echo "${var_find}"
find . -type f ${var_find} -print
# Below statement works fine.. I want to replace this with the above..
#find . \( -name "*.xml" -o -name... (4 Replies)
I want to search files (basically .cc files) in /xx folder and subfolders.
Those files (*.cc files) must contain #include "header.h" AND x() function.
I am writing it another way to make it clear,
I wanna list of *.cc files that have 'header.h' & 'x()'. They must have two strings, header.h... (2 Replies)
Hi all ,
I'm new to unix
I have a checked project , there exists a file called xxx.config .
now my task is to find all the files in the checked out project which references to this xxx.config file.
how do i use grep or find command . (2 Replies)
Hi,
I would like to use find to search for multiple types. For example search for symlink and regular file but not directories, sockets etc.... Something like:
find . -type l,f -name "stuff"
But of course it does not work.
Is there any way to avoid an if statement and to do it faster?
... (0 Replies)
Hi All,
I am new here but I have a scripting question that I can't seem to figure out with the "find" cmd.
What I am trying to do is to only have to run a single find cmd parsing the directories and output the different file types to induvidual files and I have been running into problems.... (3 Replies)
I'm looking for a way to inventory files on a webserver into a CSV file, and am particularly interested in certain types of files, like .php, .cgi, .pl, .py, .sh, etc. but also want the ability to find all files, including those with no extension, or specified extensions, as above, including files... (1 Reply)
Discussion started by: spacegoose
1 Replies
LEARN ABOUT DEBIAN
graph::unionfind
Graph::UnionFind(3pm) User Contributed Perl Documentation Graph::UnionFind(3pm)NAME
Graph::UnionFind - union-find data structures
SYNOPSIS
use Graph::UnionFind;
my $uf = Graph::UnionFind->new;
# Add the vertices to the data structure.
$uf->add($u);
$uf->add($v);
# Join the partitions of the vertices.
$uf->union( $u, $v );
# Find the partitions the vertices belong to
# in the union-find data structure. If they
# are equal, they are in the same partition.
# If the vertex has not been seen,
# undef is returned.
my $pu = $uf->find( $u );
my $pv = $uf->find( $v );
$uf->same($u, $v) # Equal to $pu eq $pv.
# Has the union-find seen this vertex?
$uf->has( $v )
DESCRIPTION
Union-find is a special data structure that can be used to track the partitioning of a set into subsets (a problem known also as disjoint
sets).
Graph::UnionFind() is used for Graph::connected_components(), Graph::connected_component(), and Graph::same_connected_components() if you
specify a true "union_find" parameter when you create an undirected graph.
Note that union-find is one way: you cannot (easily) 'ununion' vertices once you have 'unioned' them. This means that if you delete edges
from a "union_find" graph, you will get wrong results from the Graph::connected_components(), Graph::connected_component(), and
Graph::same_connected_components().
API
add
$uf->add($v)
Add the vertex v to the union-find.
union
$uf->union($u, $v)
Add the edge u-v to the union-find. Also implicitly adds the vertices.
has
$uf->has($v)
Return true if the vertex v has been added to the union-find, false otherwise.
find
$uf->find($v)
Return the union-find partition the vertex v belongs to, or "undef" if it has not been added.
new
$uf = Graph::UnionFind->new()
The constructor.
same
$uf->same($u, $v)
Return true of the vertices belong to the same union-find partition the vertex v belongs to, false otherwise.
AUTHOR AND COPYRIGHT
Jarkko Hietaniemi jhi@iki.fi
LICENSE
This module is licensed under the same terms as Perl itself.
perl v5.10.0 2008-11-27 Graph::UnionFind(3pm)