web analytics

VBA: how to read text file

This is just example, how to read text file in Visual Basic for Applications (for example, in Excel macro).

It’s just a stub: there is no error processing here, the source file is really text file, no problems with permissions etc.

Sub read_from_text_file() txtFile = Application.GetOpenFilename("Text Files (*.txt), *.txt") If txtFile = False Then […]

Perl: get file checksum

use Digest::MD5; use IO::File; my $chk = Digest::MD5->new(); foreach my $file (@ARGV) {     $chk->addfile(IO::File->new($file));     print "$file -> ",$chk->hexdigest,"\n"; }

The additional details could be found on IBM site

Oracle: file needs recovery (offline mode)

select d.file# f#, d.name, d.status, h.status from v$datafile d, v$datafile_header h where d.file# = h.file# and (d.status not in (’SYSTEM’,’ONLINE’) or h.status != ‘ONLINE’ );

If there are such files, the recovery is necessary:

restore the file from the backup recover datafile ‘&the_file_name’ ; alter database datafile ‘&the_file_name’ online;

Another possibility (if there are a […]

Unix: get the file date

ls -1 | cpio -o | cpio -ivt | awk ‘{print $NF, $(NF-1), $(NF-4), $(NF-3) }’

Warning: I/O expensive for the large files!


@a = localtime((stat($my_file))[9]); $a[4]++; printf "%02d%02d%02d",@a[5,4,3];