'Format'에 해당되는 글 2건

  1. 2009.07.20 숫자에 자릿점 찍기
  2. 2008.03.08 Windows XP, Windows Vista에서 FAT32로 포맷하기

숫자에 자릿점 찍기

l33t 2009. 7. 20. 11:34

자릿수 구분단위가 없이 큰 숫자를 보는 것은 작으면서도 큰 불편함이다.

db2에서, 또는 printf를 통해서 숫자를 출력할 때 자릿점 찍기가 불가능하다.
ksh로 역시 상당히 어렵다.

다음 펄 스크립트를 사용해 숫자에 자릿점을 넣을 수 있다.
#!/usr/bin/perl -w
use strict;

sub commarize
{
    my $text = reverse($_[0]);
    $text =~ s/(\d\d\d)(?=\d)(?!\d*\.)/$1,/g;
    return(scalar(reverse($text)));
}

my $i = 0;
while ($i <= $#ARGV)
{
    my $s = commarize($ARGV[$i]);
    printf("%s\n",$s);
    ++$i;
}
exit(0);

위 내용을
PATH가 걸린 위치에 commarize 따위의 이름으로 저장하고
chmod 777 실행권한을 지정한 후
ksh 스크립트에서 다음과 같이 사용하면 된다.

foo=$(db2 -x "select count(*) from bigTable")
bar=$(commarize ${foo})
echo "Count = ${bar}"


Posted by in0de
,
Format.exe의 FS 옵션으로 지정
C:\> FORMAT ${drive} /FS:FAT32

FAT 32 Formatter
http://www.ridgecrop.demon.co.uk/index.htm?fat32format.htm

FAT 32 Formatter GUI
http://tokiwa.qee.jp/EN/Fat32Formatter/index.html
Posted by in0de
,