사용자 도구

사이트 도구


linux:sort

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
다음 판 양쪽 다음 판
linux:sort [2013/08/19 13:30]
kwon37xi [human readable 결과 정렬]
linux:sort [2015/01/22 16:43]
kwon37xi
줄 13: 줄 13:
 # 2번 필드를 숫자로 간주하고 정렬. # 2번 필드를 숫자로 간주하고 정렬.
 sort -n -k2 sort -n -k2
 +</code>
 +
 +===== access.log 맨앞이 IP일때 IP별 호출 수 =====
 +<code sh>
 +cat access.log | awk '{print $1}' | sort | uniq -c | sort -n -k1
 +</code>
 +
 +===== 줄의 길이(line length) 순서로 정렬 =====
 +[[http://stackoverflow.com/questions/5917576/sort-a-text-file-by-line-length-including-spaces|bash - Sort a text file by line length including spaces - Stack Overflow]]
 +
 +<code sh>
 +# 정렬시 줄 길이 제거
 +awk '{print length, $0}' your-file | sort -n | cut -d " " -f2-
 +
 +# 줄 길이를 맨 앞에 넣음.
 +awk '{print length, $0}' your-file | sort -n
 </code> </code>
  
linux/sort.txt · 마지막으로 수정됨: 2021/08/16 11:43 저자 kwon37xi