internet

[알림판목록 I] [알림판목록 II] [글목록][이 전][다 음]
[ internet ] in KIDS
글 쓴 이(By): baek (  baek)
날 짜 (Date): 1995년10월20일(금) 07시33분47초 KST
제 목(Title): postscript 화일 --> text 화일



/usr/local/bin/gs가 있을때 아래 shell script를 사용하면
한글을 제외한 영문은 text로 바꿀 수 있습니다.
format은 별로 좋지 않지만 읽을 수는 있죠.

----------------[ cut here ]-----------------------
#!/bin/sh -f
# Extract ASCII text from a PostScript file.  Usage:
#   ps2ascii [infile.ps [outfile.txt]]
# If outfile is omitted, output goes to stdout.
# If both infile and outfile are omitted, ps2ascii acts as a filter,
# reading from stdin and writing on stdout.
if ( test $# -eq 0 ) then
  gs -q -dNODISPLAY -dNOBIND -dWRITESYSTEMDICT -dSIMPLE ps2ascii.ps - -c quit
elif ( test $# -eq 1 ) then
  gs -q -dNODISPLAY -dNOBIND -dWRITESYSTEMDICT -dSIMPLE ps2ascii.ps $1 -c quit
else
  gs -q -dNODISPLAY -dNOBIND -dWRITESYSTEMDICT -dSIMPLE ps2ascii.ps $1 -c quit
 >$2
fi
----------------[ cut here ]-----------------------

그리고 또다른 ps2ascii script 도 있습니다.

----------------[ cut here ]-----------------------
#! /usr/local/bin/perl -P
########################################################
# ps2ascii: look through a PostScript file for ASCII strings
#
# Usage:
#     ps2ascii <inputfile.ps>
#
########################################################

$out = "";
while(<>)
{
  $line = $_;
  while($line =~/\((.*)\)(.*)/) {
       $line = $2;
       if(length($out)+length($1) > 76) {
         print "$out\n";
         $out="";
       }
       $out=$out." ".$1;
  }
}
print "$out\n";
----------------[ cut here ]-----------------------


... A Fun A Day ...


[알림판목록 I] [알림판목록 II] [글 목록][이 전][다 음]
키 즈 는 열 린 사 람 들 의 모 임 입 니 다.