Sponsored Content
Full Discussion: Command to get file size..
Top Forums UNIX for Dummies Questions & Answers Command to get file size.. Post 302148594 by Perderabo on Monday 3rd of December 2007 01:49:59 AM
Old 12-03-2007
How about using perl to invoke the stat system call...

perl -e 'printf "%d\n" ,(stat(shift))[7]; ' somefile
should do it. And HP-UX has an older perl in /usr/contrib/bin in case you have not installed a modern version of perl.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

File size limitation of unix sort command.

hi , iam trying to sort millions of records which is delimited and i cant able to use sort command more than 60 million..if i try to do so i got an message stating that "File size limit exceeded",Is there any file size limit for using sort command.. How can i solve this problem. thanks ... (7 Replies)
Discussion started by: cskumar
7 Replies

2. Solaris

command to find out total size of a specific file size (spread over the server)

hi all, in my server there are some specific application files which are spread through out the server... these are spread in folders..sub-folders..chid folders... please help me, how can i find the total size of these specific files in the server... (3 Replies)
Discussion started by: abhinov
3 Replies

3. UNIX for Dummies Questions & Answers

Extracting only file size of the ls -ltr command.

All, I only need to get the file size when I do an ls -ltr filename.txt Could you give me the exact syntax. Thanks KOP (6 Replies)
Discussion started by: kingofprussia
6 Replies

4. HP-UX

command to list file size

I'm new to HP-UX and am looking for the command that will allow to me determine the total size of listed files. I'm being told that my backup selection is exceeding my tape drive size and need to determine how much information is being backed up. Help? (3 Replies)
Discussion started by: rgordon
3 Replies

5. Shell Programming and Scripting

command to read file name and size

hi all, there is any command or anything we can use to read the file name and size. thanks (6 Replies)
Discussion started by: s_linux
6 Replies

6. Shell Programming and Scripting

command to reduce size of file/directory???

Hello, I want to compress any given file or directory. I used 1)gzip 2)zip But when I do "ls -l". I found that the zipped file is in fact greater in size than the original file. Can you please tell me the commands which will show me the difference in its size. (2 Replies)
Discussion started by: nsharath
2 Replies

7. HP-UX

Performance issue with 'grep' command for huge file size

I have 2 files; one file (say, details.txt) contains the details of employees and another file (say, emp.txt) has some selected employee names. I am extracting employee details from details.txt by using emp.txt and the corresponding code is: while read line do emp_name=`echo $line` grep -e... (7 Replies)
Discussion started by: arb_1984
7 Replies

8. Shell Programming and Scripting

Script to monitor for new file with ext .err and size > 0 bytes and perform a action or command

Hi All, I need to create a script to monitor a dir for new files with ext .err and also it should b a non empty files. and perform a action or command . We have a new ETL application that runs on a linux server, every times a etl fails it creates a .err file or updates the existing .err... (4 Replies)
Discussion started by: MAKHAN
4 Replies

9. HP-UX

find command to display size and date of a file

Hi, The blow code does not yeild any output. find . -name "*.jar" -o -name "*.ksh" -o -name "*.properties" -name "*.war" -o -name "*.ear" -o -name "*.sh" -o -name "*.cfg" -exec ls -l {} \; I wish to print the filename filesize filedate in HP-UX. Can anyone help ? (9 Replies)
Discussion started by: mohtashims
9 Replies
lfc_perl(3)						 Perl Programmers Reference Guide					       lfc_perl(3)

NAME
lfc - Perl interface to the LFC SYNOPSIS
use lfc; printf "CNS_LIST_BEGIN is %d ", $lfc::CNS_LIST_BEGIN; DESCRIPTION
The lfc module permits you to access the LFC client interface from perl programs. The lfc module is a swig wrapping of the standard C interface. For detailed descriptions of each function see the individual man page of each function. There follows a series of examples of how to use selected functions and how to retrieve the information returned by them: Examples are finding the GUID of an existing entry, listing the replicas of a given GUID and setting and retrieving the comment associated with an entry. EXAMPLE
#!/usr/bin/perl -w use strict; use lfc; # stat an existing entry in the LFC and print the GUID my ($name,$stat,$guid,$res); $name = "/grid/dteam/my.test"; $stat = lfcc::new_lfc_filestatg(); $res = lfc::lfc_statg($name,undef,$stat); if ($res == 0) { $guid = lfcc::lfc_filestatg_guid_get($stat); print "The GUID for $name is $guid "; } else { my $err_num = $lfc::serrno; my $err_string = lfc::sstrerror($err_num); print "There was an error while looking for $name: Error $err_num ($err_string) "; exit(1); } lfcc::delete_lfc_filestatg($stat); EXAMPLE
#!/usr/bin/perl -w use strict; use lfc; # list the replicas of a given entry, starting from the GUID my ($guid,$listp,$flag,$num_replicas); $guid = "6a3164e0-a4d7-4abe-9f76-e3b8882735d1"; $listp = lfcc::new_lfc_list(); $flag = $lfc::CNS_LIST_BEGIN; print "Listing replicas for GUID $guid: "; $num_replicas=0; while(1) { my $res = lfc::lfc_listreplica(undef,$guid,$flag,$listp); $flag = $lfc::CNS_LIST_CONTINUE; if (!defined $res) { last; } else { my $rep_name = lfcc::lfc_filereplica_sfn_get($res); print "Replica: $rep_name "; $num_replicas++; } } lfc::lfc_listreplica(undef,$guid,$lfc::CNS_LIST_END,$listp); lfcc::delete_lfc_list($listp); print "Found $num_replicas replica(s) "; EXAMPLE
#!/usr/bin/perl -w use strict; use lfc; # setting and retrieving a comment on a file my ($file,$res,$bufspec,$buffer,$comment); $file = "/grid/dteam/my.test"; $comment = "MyComment"; $res = lfc::lfc_setcomment($file,$comment); if ($res != 0) { my $err_num = $lfc::serrno; my $err_string = lfc::sstrerror($err_num); print "Problem while setting comment for $file: Error $err_num ($err_string) "; exit(1); } $bufspec = "x".($lfc::CA_MAXCOMMENTLEN+1); $buffer = pack($bufspec); $res = lfc::lfc_getcomment($file,$buffer); if ($res != 0) { my $err_num = $lfc::serrno; my $err_string = lfc::sstrerror($err_num); print "Problem while reading the comment for $file: Error $err_num ($err_string) "; exit(1); } $comment = unpack("Z*", $buffer); print "Read back comment $comment "; NOTES
The current interface to the lfc_getcomment(3), lfc_getcwd(3), lfc_readlink(3), lfc_seterrbuf(3) requires the passing of a suitably allo- cated buffer (in a similar way to the C functions). However this is rather non standard in PERL. A future version of lfc perl interface may do away with the need to setup the buffer before the call and to explicitly unpack the result afterwards. SEE ALSO
LFC C interface man pages LFC
$Date: 2007/02/23 10:03:07 $ lfc_perl(3)
All times are GMT -4. The time now is 07:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy