開発環境
- OS X Lion - Apple(OS)
- BBEdit - Bare Bones Software, Inc.(Text Editor)
- Script言語:Perl
その他参考書籍
1.
コード(BBEdit)
sample.pl
#!/usr/bin/env perl use strict; use warnings; use utf8; use 5.016; binmode STDOUT, ':utf8'; binmode STDIN, ':utf8'; print map{" $_\n"} grep { -s $_ < 1000} @ARGV;
入出力結果(Terminal)
$ ./sample.pl * Oogaboogoo __pycache__ barney betty date.txt fred gilligan.info ginger.info hello_world.pl link_test ln.txt ln1.txt log lovey.info ls.err maryann.info monkeyman.info numbers perl_program1 professor.info sample sample.pl sample.pl.bak sample.py sample_folder skipper.info some_file some_folder sortable_hash test.out test.txt test_folder test_link thurston.info tmp.txt tmp_folder untitled text 2.txt $
pythonの場合。
sample.py
コード(BBEdit)
#!/usr/bin/env python3.3 #-*- coding: utf-8 -*- import os, sys argv = sys.argv[1:] files = [] for file in argv: if os.path.getsize(file) < 1000: files.append(file) a = map(lambda x: " {0}\n".format(x), files) for file in a: print(file, end="")
入出力結果(Terminal)
$ ./sample.py * Oogaboogoo __pycache__ barney betty date.txt fred gilligan.info ginger.info hello_world.pl link_test ln.txt ln1.txt log lovey.info ls.err maryann.info monkeyman.info numbers perl_program1 professor.info sample sample.pl sample.pl.bak sample.py sample_folder skipper.info some_file some_folder sortable_hash test.out test.txt test_folder test_link thurston.info tmp.txt tmp_folder untitled text 2.txt $
0 コメント:
コメントを投稿