04-16-2007
Grep with count
I need to count the number of instances of a dir in a set of dir with the same suffix .txt (one dir and all recursive directories).
<Main Dir>
<sub_dir1>
<sub_dir2>
<sub_dir3>
<sub_dir4>
and count the number of instances of a type of file, ie/ .txt files
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
The following command lists the files which has "wPOREQ" in the files whose names are like:M*08042007*
grep -l "aaa" M*08042007*
I want to know the count of the files.
Thank you for the help. (2 Replies)
Discussion started by: sudheshnaiyer
2 Replies
2. UNIX for Dummies Questions & Answers
Hi
My files is like
a|test|s|
b|test2 | n|
c|ggg|v|
i want to count the no of lines which is ending with "|" ...
Please let me know how can it be done.
Thanks,
Arun (4 Replies)
Discussion started by: arunkumar_mca
4 Replies
3. UNIX for Dummies Questions & Answers
Hi,
I trying to sort information in a file by making count for every object. For example:
A
B
A
D
A
B
C
i would like to sort out count for each object (A's, B's and etc) but in actual case i dont know the object but i know the position ofthe object. do i need to use array as well? Any... (2 Replies)
Discussion started by: sukhpal_78
2 Replies
4. UNIX for Dummies Questions & Answers
I've got following script that I thought would only email me when the if clause finds the grep. But it emails me anyway (with an empty file) even if the grep doesn't return anything.
What should the line be?
if
then grep -l 'unique constraint' $LOGDIR/archive_active* >... (3 Replies)
Discussion started by: Meert
3 Replies
5. UNIX for Dummies Questions & Answers
Hi, I have several files with same filename pattern. I want to calculate count of individual files using grep/egrep. Let me be more descriptive
In directory E1 i have files like
ab_20091201_12:24 ab_20091201_03:24 cd_20091201_04:16 cd_20091203_08:34 ef_20091201_06:12 ef_20091201
Now i want... (3 Replies)
Discussion started by: shounakboss
3 Replies
6. UNIX for Dummies Questions & Answers
How do I do a grep wc that counts occurences of two or more different strings?
If I have string1 two times and string2 three times, how do I use wc to get the number 5? (1 Reply)
Discussion started by: locoroco
1 Replies
7. UNIX for Dummies Questions & Answers
Hi,
It is very interesting to learn the unix, i just struck with a doubt like i have below content in my file
xyz
xyz xyz
xyz
i just want know the word count by using grep -wc 'xyz' <filename>,
but it is giving 3 instead of 4.So i understood that it is showing matched line numbers count... (2 Replies)
Discussion started by: vmachava
2 Replies
8. UNIX for Dummies Questions & Answers
I have a delimited file (by |), and the second field is made out of Surnames.
Is it possible to list the surnames together with their count of occurances.
For example, image the first two lines are the following:
Joe | Doe | 30
Jane | Doe | 28
Peter | Smith | 25
John | Jones | 26
I... (2 Replies)
Discussion started by: mouthpiec
2 Replies
9. Shell Programming and Scripting
got a file as y.txt
1 abc,def,ghj
2 defj,abc.kdm,ijk
3 lmn,cbk,mno
4 tmp,tmop,abc,pkl
5 pri,chk,cbk,lmo
6 def,cbk.pro,abc.kdm
i want to search in the above file the key word like abc
looking for two outcomes by passing the parameter value as abc into function and the two outocmes are... (0 Replies)
Discussion started by: silgun
0 Replies
10. Shell Programming and Scripting
Hi Friends,
I want to find all processes beginning with the name 'Admin' and then do a grep count on those processes containing a specific string i.e. However, it is giving below error
ps -ef | grep ^Admin | grep -ic 'Jan' -e 'Feb' -e 'Mar'
grep: Jan: No such file or directory
... (4 Replies)
Discussion started by: srkmish
4 Replies
LEARN ABOUT DEBIAN
masonx::processdir
MasonX::ProcessDir(3pm) User Contributed Perl Documentation MasonX::ProcessDir(3pm)
NAME
MasonX::ProcessDir - Process a directory of Mason 2 templates
VERSION
version 0.02
SYNOPSIS
use MasonX::ProcessDir;
# Generate result files in the same directory as the templates
#
my $pd = MasonX::ProcessDir->new(
dir => '/path/to/dir'
);
$pd->process_dir();
# Generate result files in a separate directory
#
my $pd = MasonX::ProcessDir->new(
source_dir => '/path/to/source/dir',
dest_dir => '/path/to/dest/dir'
);
$pd->process_dir();
DESCRIPTION
Recursively processes a directory of Mason 2 templates, generating a set of result files in the same directory or in a parallel directory.
Every file with suffix ".mc" will be processed, and the results placed in a file of the same name without the suffix. ".mi", autobase and
dhandler files will be used by Mason when processing the templates but will not generate files themselves.
For example, if the source directory contains
Base.mc
httpd.conf.mc
proxy.conf.mc
etc/crontab.mc
blah.mi
somefile.txt
and we run
my $pd = MasonX::ProcessDir->new(
source_dir => '/path/to/source/dir',
dest_dir => '/path/to/dest/dir'
);
$pd->process_dir();
then afterwards the destination directory will contain files
httpd.conf
proxy.conf
etc/crontab
somefile.txt
where foo and bar are the results of processing foo.mc and bar.mc through Mason. Base.mc and blah.mi may be used during Mason processing
but won't generate result files themselves.
This class is a convenience extension of Any::Template::ProcessDir.
CONSTRUCTOR
Specifying directory/directories
o If you want to generate the result files in the same directory as the templates, just specify dir.
my $pd = MasonX::ProcessDir->new(
dir => '/path/to/dir',
...
);
o If you want to generate the result files in a separate directory from the templates, specify source_dir and dest_dir.
my $pd = MasonX::ProcessDir->new(
source_dir => '/path/to/source/dir',
source_dir => '/path/to/dest/dir',
...
);
Mason options
mason_options
An optional hash of options to the Mason interpreter. For example, the default Mason data directory will be ".mason" under the source
directory, but you can override this:
mason_options => { data_dir => '/path/to/data/dir' }
Options inherited from Any::Template::ProcessDir
See Any::Template::ProcessDir for other options, such as
dir_create_mode
file_create_mode
readme_filename
SUPPORT AND DOCUMENTATION
Bugs and feature requests will be tracked at RT:
http://rt.cpan.org/NoAuth/Bugs.html?Dist=MasonX-ProcessDir
bug-masonx-processdir@rt.cpan.org
The latest source code can be browsed and fetched at:
http://github.com/jonswar/perl-masonx-processdir
git clone git://github.com/jonswar/perl-masonx-processdir.git
SEE ALSO
Mason, Any::Template::ProcessDir
AUTHOR
Jonathan Swartz <swartz@pobox.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Jonathan Swartz.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
perl v5.14.2 2012-03-07 MasonX::ProcessDir(3pm)