Hi all. If I have a unix directory with multiple files, lets say, I have some with .dat extensions, some with .txt extensions, etc etc.
How in a script would I provide a count of all the different file types (so, the different extensions, I guess) in the directory??
So if I had:
test.dat... (6 Replies)
Hi,
I have a load of if statements that look for files in a directory, I want to be able to count them up and the total files confirmed in an email? I ahve tried expr but i this does not work and it only reads in the first if and ignores the rest.
Please see script,
#!/bin/ksh
... (2 Replies)
I'm regularly counting the number of rows in a number of files. I need to know how many rows their are in all files together. Counting rows in one file I can handle, but how do I count rows in all at once?
I'd be grateful for any answer. (7 Replies)
I've been away from Unix and the vi editor for a while, and now I'm using vi (actually vim) in a Cygwin bash shell. When I copy-and-paste code examples (I'm playing with perl now) any time I paste code with lines beginning with the # character, vi inserts a # character at the beginning of every... (2 Replies)
In a script, how would I go about finding the number of files for the first parameter after my script name?
For instance, my script name is myscript.sh and the folder I am checking is not the current working directory, lets say it's folder1.
so I type myscript.sh folder1
This script below... (2 Replies)
My folder is/app2/istech/scratch, which contain all the below files.
I need to delete the files which start from the prefixes.
dup_events_*.*
Event_*.*
New_time_*.*
New_Loc_*.*
New_Uptime_*.*
Detailed_Reason*.*
cmt_dup_*.*
Uptime_*.*
Can anyone please let me know how to write a... (3 Replies)
i need to write a shell script to "count the number of files in the current directory but without using either ls or wc command".....
please help! (1 Reply)
Perl::Critic::Policy::Variables::RequireNegativeIndices(User Contributed Perl DocumentPerl::Critic::Policy::Variables::RequireNegativeIndices(3pm)NAME
Perl::Critic::Policy::Variables::RequireNegativeIndices - Negative array index should be used.
AFFILIATION
This Policy is part of the core Perl::Critic distribution.
DESCRIPTION
Conway points out that
$arr[$#arr];
$arr[$#arr-1];
$arr[@arr-1];
$arr[@arr-2];
are equivalent to
$arr[-1];
$arr[-2];
$arr[-1];
$arr[-2];
and the latter are more readable, performant and maintainable. The latter is because the programmer no longer needs to keep two variable
names matched.
This policy notices all of the simple forms of the above problem, but does not recognize any of these more complex examples:
$some->[$data_structure]->[$#{$some->[$data_structure]} -1];
my $ref = @arr;
$ref->[$#arr];
CONFIGURATION
This Policy is not configurable except for the standard options.
AUTHOR
Chris Dolan <cdolan@cpan.org>
COPYRIGHT
Copyright (c) 2006-2011 Chris Dolan.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.14.2 2012-06-07 Perl::Critic::Policy::Variables::RequireNegativeIndices(3pm)