Could you please try following and let me know if this helps. EDIT:Also in above command you could change command to as follows too where you could mention the path from where you want to look for the files.
Thanks,
R. Singh
Last edited by RavinderSingh13; 05-16-2016 at 08:23 AM..
Reason: Added a small comment and improved solution for same now too.
I have a flat file and need to count no of records in the file less the header and the trailer record.
I would appreciate any and all asistance
Thanks
Hadi Lalani (2 Replies)
Hi All,
I have two files say file1 and file2.
I want to check the number of records in file1 and if its atleast 2 (i.e., 2 or greater than 2 ) then I have to check records in file2 .If records in file2 is atleast 1 (i.e. if its not empty ) i have to set some conditions .
Could you pls... (3 Replies)
Hello
I am trying to generate a script to run on worldwide firewalls.
I need the spf block for large sites like google, etc so I can essentially whitelist google sites for users.
(Google here is just an example...)
Right now I am just testing Bash oneliners to see how I can isolate the... (1 Reply)
Hi,
I urgently need help with an assignment I must complete by tomorrow. I started Bash Scripting yesterday so am a complete newbie. I don't have time to teach myself Bash scripting so please don't redirect me to some tutorials.
The assignment I have to do involves the following:
the aim... (1 Reply)
consider this as a csv file.
H,0002,0002,20100218,17.25,P,barani
D,1,2,3,4,5,6,7,8,9,10,11
D,1,2,3,4,5,6,7,8,9,10,11
D,1,2,3,4,5,6,7,8,9,10,11
D,1,2,3,4,5,6,7,8,9,10,11
D,1,2,3,4,5,6,7,8,9,10,11
T,5
N
i want to read the csv file and count the number of rows that start with D and... (11 Replies)
Hi everyone.
I am a newbie to Linux stuff. I have this kind of problem which couldn't solve alone. I have a text file with records separated by empty lines like this:
ID: 20
Name: X
Age: 19
ID: 21
Name: Z
ID: 22
Email: xxx@yahoo.com
Name: Y
Age: 19
I want to grep records that... (4 Replies)
I have 2 files
"File 1" is delimited by ";" and "File 2" is delimited by "|".
File 1 below (3 record shown):
Doc1;03/01/2012;New York;6 Main Street;Mr. Smith 1;Mr. Jones
Doc2;03/01/2012;Syracuse;876 Broadway;John Davis;Barbara Lull
Doc3;03/01/2012;Buffalo;779 Old Windy Road;Charles... (2 Replies)
Hi I am new to shell programming in unix
Please if I can provide help.
I have a file structure of a header record and "N" detail records.
The header record will be the total number of detail records
I need to split the file in 2:
One for the header
Another for all detail records
Could... (1 Reply)
Discussion started by: jamcogar
1 Replies
LEARN ABOUT DEBIAN
file::fu
File::Fu(3pm) User Contributed Perl Documentation File::Fu(3pm)NAME
File::Fu - file and directory objects
SYNOPSIS
The directory constructor:
use File::Fu;
my $dir = File::Fu->dir("bar");
print "$dir
"; # 'bar/'
my $file = $dir + 'bar.txt';
print "$file
"; # 'bar/bar.txt'
my $d2 = $dir % 'baz'; # 'barbaz/'
my $d3 = $dir / 'bat'; # 'bar/bat/'
my $file2 = $dir / 'bat' + 'foo.txt'; # 'bar/bat/foo.txt'
The file constructor:
my $file = File::Fu->file("foo");
$file->e and warn "$file exists";
$file->l and warn "$file is a link";
warn "file is in ", $file->dir;
ABOUT
This class provides the toplevel interface to File::Fu directory and file objects, with operator overloading which allows precise path
composition and support for most builtin methods, as well as creation of temporary files/directories, finding files, and more.
The interface and style are quite different than the perl builtins or File::Spec. The syntax is concise. Errors are thrown with croak(),
so you never need to check a return code.
Constructors
The actual objects are in the 'Dir' and 'File' sub-namespaces.
dir
my $dir = File::Fu->dir($path);
See "new" in File::Fu::Dir
file
my $file = File::Fu->file($path);
See "new" in File::Fu::File
Class Constants
tmp
Your system's '/tmp/' directory (or equivalent of that.)
my $dir = File::Fu->tmp;
home
User's $HOME directory.
my $dir = File::Fu->home;
program_name
The absolute name of your program. This will be relative from the time File::Fu was loaded. It dies if the name is '-e'.
my $prog = File::Fu->program_name;
If File::Fu was loaded after a chdir and the $0 was relative, calling program_name() throws an error. (Unless you set $0 correctly before
requiring File::Fu.)
program_dir
Returns what typically corresponds to program_name()->dirname, but just the compile-time cwd() when $0 is -e/-E.
my $dir = File::Fu->program_dir;
Class Methods
THIS_FILE
A nicer way to say __FILE__.
my $file = File::Fu->THIS_FILE;
cwd
The current working directory.
my $dir = File::Fu->cwd;
which
Returns File::Fu::File objects of ordered candidates for $name found in the path.
my @prog = File::Fu->which($name) or die "cannot find $name";
If called in scalar context, returns a single File::Fu::File object or throws an error if no candidates were found.
my $prog = File::Fu->which($name);
Temporary Directories and Files
These class methods call the corresponding File::Fu::Dir methods on the value of tmp(). That is, you get a temporary file/dir in the
'/tmp/' directory.
temp_dir
my $dir = File::Fu->temp_dir;
temp_file
my $handle = File::Fu->temp_file;
Subclassing
You may wish to subclass File:Fu and override the dir_class() and/or file_class() class methods to point to your own Dir/File subclasses.
my $class = 'My::FileFu';
my $dir = $class->dir("foo");
See File::Fu::File and File::Fu::Dir for more info.
See Also
File::Fu::why if I need to explain my motivations.
Path::Class, from which many an idea was taken.
File::stat, IO::File, File::Spec, File::Find, File::Temp, File::Path, File::Basename, perlfunc, perlopentut.
AUTHOR
Eric Wilhelm @ <ewilhelm at cpan dot org>
http://scratchcomputing.com/
BUGS
If you found this module on CPAN, please report any bugs or feature requests through the web interface at <http://rt.cpan.org>. I will be
notified, and then you'll automatically be notified of progress on your bug as I make changes.
If you pulled this development version from my /svn/, please contact me directly.
COPYRIGHT
Copyright (C) 2008 Eric L. Wilhelm, All Rights Reserved.
NO WARRANTY
Absolutely, positively NO WARRANTY, neither express or implied, is offered with this software. You use this software at your own risk. In
case of loss, no person or entity owes you anything whatsoever. You have been warned.
LICENSE
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.10.1 2010-05-13 File::Fu(3pm)