- プログラミングのお題スレ Part4
990 :デフォルトの名無しさん[sage]:2014/09/20(土) 02:04:04.92 ID:M/9MxdSa - >>931 Emacs Lisp
% cat h:/honda/本田_10.TXT hドライブの「honda」フォルダ内のファイル:本田_10.TXTを読み込み、英大文字を英小文字に変換、英小文字を英大文字に変換、その他はそのままで表示せよ。 % cat aaa.sh #!/bin/sh emacs -batch -Q --eval=' (progn (require (quote cl-lib)) (princ (with-temp-buffer (insert-file-contents (car (last command-line-args))) (cl-map (quote string) (lambda (x) (cond ((eq (aref (standard-case-table) x) x) (upcase x)) ((aref (standard-case-table) x) (downcase x)) (t x))) (buffer-substring (point-min) (point-max))))))' $1 exit $? % sh aaa.sh h:/honda/本田_10.TXT Hドライブの「HONDA」フォルダ内のファイル:本田_10.txtを読み込み、英大文字を英小文字に変換、英小文字を英大文字に変換、その他はそのままで表示せよ。
|