"Join"의 두 판 사이의 차이
ph
(새 문서: <code>sort <no options> | join <no options></code> doesn't work: Important: FILE1 and FILE2 must be sorted on the join fields. E.g., use ` sort -k 1b,1 ' if `join' has no options,...) |
잔글 |
||
(같은 사용자의 중간 판 3개는 보이지 않습니다) | |||
4번째 줄: | 4번째 줄: | ||
`sort' has no options. | `sort' has no options. | ||
So you could try: | So you could try: | ||
− | sort flash_int_list.txt | join -t '' finish_comm - > t1 | + | sort flash_int_list.txt | join -t <nowiki>''</nowiki> finish_comm - > t1 |
or: | or: | ||
sort -k 1b,1 flash_int_list.txt | join finish_comm - > t1 | sort -k 1b,1 flash_int_list.txt | join finish_comm - > t1 | ||
[http://unix.stackexchange.com/a/55911/31363] | [http://unix.stackexchange.com/a/55911/31363] | ||
+ | |||
+ | -e는 -o하고 같이 써야 제대로 나온다. | ||
+ | $ join -a 1 -a 2 -e'-' -o '0,1.2,2.2' sfile1.txt sfile2.txt # -o auto 해도 됨. -a 반드시 있어야 -e 의미있음 주의. | ||
+ | bar 2 - | ||
+ | boo - z | ||
+ | foo 1 x | ||
+ | qux 3 y | ||
+ | http://stackoverflow.com/a/984997/766330 | ||
+ | |||
+ | 탭 구분자 | ||
+ | join file1 file12 -t $'\t' | ||
+ | http://stackoverflow.com/a/1722424/766330 |
2017년 9월 20일 (수) 12:17 기준 최신판
sort <no options> | join <no options>
doesn't work:
Important: FILE1 and FILE2 must be sorted on the join fields. E.g., use ` sort -k 1b,1 ' if `join' has no options, or use ` join -t ' if `sort' has no options.
So you could try:
sort flash_int_list.txt | join -t '' finish_comm - > t1
or:
sort -k 1b,1 flash_int_list.txt | join finish_comm - > t1
-e는 -o하고 같이 써야 제대로 나온다.
$ join -a 1 -a 2 -e'-' -o '0,1.2,2.2' sfile1.txt sfile2.txt # -o auto 해도 됨. -a 반드시 있어야 -e 의미있음 주의. bar 2 - boo - z foo 1 x qux 3 y
http://stackoverflow.com/a/984997/766330
탭 구분자
join file1 file12 -t $'\t'