Hi thanks for your reply it's working now.Now i need to add sum (Total).Example below
Hello Adfire,
Please always use code tags as per forum rules for your commands/codes/Input_files, could you please try following and let me know if this helps you.
Output will be as follows.
Thanks,
R. Singh
Hi,
Please guide me if there is any option of converting text from the
following format using regexp etc,
1,a,b,c,d,e,f,d
2,aa,bb,cc,dd,ee,ff
1,6a,6b,6c,6d,6e,6c
2,7a,7b,7c,7d,7e,7f
to be group into 1'ns together and 2's together as follows.
1,a,b,c,d,e,f,d
1,6a,6b,6c,6d,6e,6c... (1 Reply)
Hello,
I have a big data file (160 MB) full of records with pipe(|) delimited those fields. I`m sorting the file on the first field.
I'm trying to sort with "sort" command and it brings me 6 minutes.
I have tried with some transformation methods in perl but it results "Out of memory". I was... (2 Replies)
cat file1.txt
field1 "user1":
field2:"data-cde"
field3:"data-pqr"
field4:"data-mno"
field1 "user1":
field2:"data-dcb"
field3:"data-mxz"
field4:"data-zul"
field1 "user2":
field2:"data-cqz"
field3:"data-xoq"
field4:"data-pos"
Now i need to have the date like below.
i have just... (7 Replies)
I have a text file and each field is separated by semicolon ( ; ). Field number 7 is internally separated by comma ( , ) and pipe ( | ) symbol. I want to sort file based on three different fields which are marked in BOLD.
Here first BOLD field will have numbers upto the length of 9 characters,... (6 Replies)
Dear Friends,
I am in urgent need for awk/sed/sh script for converting a specific data format (.txt) to .xls.
The input is as follows:
>gi|1234|ref|
Query = 1 - 65, Target = 1677 - 1733
Score = 8.38, E = 0.6529, P = 0.0001513, GC = 46
fd sdfsdfsdfsdf
fsdfdsfdfdfdfdfdf... (6 Replies)
Hi ,
i am generating some data by firing sql query with connecting to the database by my solaris box.
The below one should be the header line of my excel ,here its coming in separate row.
TO_CHAR(C. CURR_EMP_NO
---------- ---------------
LST_NM... (6 Replies)
Hello,
I'm trying to sort a large data file by the 3rd column so that all of the first words in the 3rd column that are in all uppercase appear before (or after) the non uppercase words. For example,
Data file:
xxx 12345 Rat in the house
xxx 12345 CAT in the hat
xxx 12345 Dog in the... (4 Replies)
Hi
i have a file containing below info and want it to put in xl format
2878042 455134 3333176 24.231979 23.81
2880246 453022 3333268 24.141338 23.81
2879677 453495 3333172 24.310986 23.81i want this data in XL file format and want that my linux system should send me that file on my mail.... (8 Replies)
Discussion started by: scriptor
8 Replies
LEARN ABOUT DEBIAN
filesys::df
Df(3pm) User Contributed Perl Documentation Df(3pm)NAME
Filesys::Df - Perl extension for filesystem disk space information.
SYNOPSIS
use Filesys::Df;
#### Get information by passing a scalar directory/filename value
my $ref = df("/tmp"); # Default output is 1K blocks
if(defined($ref)) {
print "Total 1k blocks: $ref->{blocks}
";
print "Total 1k blocks free: $ref->{bfree}
";
print "Total 1k blocks avail to me: $ref->{bavail}
";
print "Total 1k blocks used: $ref->{used}
";
print "Percent full: $ref->{per}
";
if(exists($ref->{files})) {
print "Total inodes: $ref->{files}
";
print "Total inodes free: $ref->{ffree}
";
print "Inode percent full: $ref->{fper}
";
}
}
#### Get information by passing a filehandle
open(FILE, "some_file"); # Get information for filesystem at "some_file"
my $ref = df(*FILE);
#### or
my $ref = df(*FILE);
#### or
my $fhref = *FILE;
my $ref = df($fhref);
#### Get information in other than 1k blocks
my $ref = df("/tmp", 8192); # output is 8K blocks
my $ref = df("/tmp", 1); # output is bytes
DESCRIPTION
This module provides a way to obtain filesystem disk space information. This is a Unix only distribution. If you want to gather this
information for Unix and Windows, use "Filesys::DfPortable". The only major benefit of using "Filesys::Df" over "Filesys::DfPortable", is
that "Filesys::Df" supports the use of open filehandles as arguments.
The module should work with all flavors of Unix that implement the "statvfs()" and "fstatvfs()" calls, or the "statfs()" and "fstatfs()"
calls. This would include Linux, *BSD, HP-UX, AIX, Solaris, Mac OS X, Irix, Cygwin, etc ...
"df()" requires a argument that represents the filesystem you want to query. The argument can be either a scalar directory/file name or a
open filehandle. There is also an optional block size argument so you can tailor the size of the values returned. The default block size is
1024. This will cause the function to return the values in 1k blocks. If you want bytes, set the block size to 1.
"df()" returns a reference to a hash. The keys available in the hash are as follows:
"{blocks}" = Total blocks on the filesystem.
"{bfree}" = Total blocks free on the filesystem.
"{bavail}" = Total blocks available to the user executing the Perl application. This can be different than "{bfree}" if you have per-user
quotas on the filesystem, or if the super user has a reserved amount. "{bavail}" can also be a negative value because of this. For
instance if there is more space being used then you have available to you.
"{used}" = Total blocks used on the filesystem.
"{per}" = Percent of disk space used. This is based on the disk space available to the user executing the application. In other words, if
the filesystem has 10% of its space reserved for the superuser, then the percent used can go up to 110%.
You can obtain inode information through the module as well, but you must call "exists()" on the "{files}" key first, to make sure the
information is available. Some filesystems may not return inode information, for example some NFS filesystems.
Here are the available inode keys:
"{files}" = Total inodes on the filesystem.
"{ffree}" = Total inodes free on the filesystem.
"{favail}" = Total inodes available to the user executing the application. See the rules for the "{bavail}" key.
"{fused}" = Total inodes used on the filesystem.
"{fper}" = Percent of inodes used on the filesystem. See rules for the "{per}" key.
There are some undocumented keys that are defined to maintain backwards compatibilty: "{su_blocks}", "{user_blocks}", etc ...
If the "df()" call fails for any reason, it will return undef. This will probably happen if you do anything crazy like try to get
information for /proc, or if you pass an invalid filesystem name, or if there is an internal error. "df()" will "croak()" if you pass it a
undefined value.
Requirements: Your system must contain "statvfs()" and "fstatvfs()", or "statfs()" and "fstatfs()" You must be running Perl 5.6 or higher.
AUTHOR
Ian Guthrie IGuthrie@aol.com
Copyright (c) 2006 Ian Guthrie. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
SEE ALSO statvfs(2), fstatvfs(2), statfs(2), fstatfs(2), df(1), Filesys::DfPortable
perl(1).
perl v5.14.2 2006-06-25 Df(3pm)