This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
lines = [] | |
for line in sys.stdin: | |
line = line.rstrip() | |
tokens = line.split('\t') | |
src, tgt = tokens[0], tokens[1] | |
lines.append(((src,tgt), line)) #TODO | |
lines.sort(key=lambda a:a[0]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def counter(interval): | |
if not hasattr(counter,'count'): | |
counter.count = 0 | |
counter.count += 1 | |
import sys | |
if counter.count % interval == 0: print >>sys.stderr, counter.count |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [[ $# != 2 && $# != 3 ]] | |
then | |
echo '需要至少两个参数' >&2 | |
echo 'usage:' | |
echo "$(basename $0) file1 file2 tmpdir" >&2 | |
exit 1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env python | |
#usage argv[0] file_tobe_split target_dir | |
#按第一字段切分文件 | |
import sys | |
src_file = sys.argv[1] | |
tgt_dir = sys.argv[2] |
NewerOlder