2011-03-24 1 views
3

이 같은 파일 가지고는 열 값에 기초하여 다수에 하나의 파일을 분리

one vijay three 
two vijay four 
five chandu three 

outputfile1

one vijay three 
two vijay four 

outputfile2

five chandu three 

파일이 분할에 기초를 두 번째 열의 값

쉘 스크립팅에서이 작업을 수행 할 수 있습니다.하지만 awk에서 더 간단하다고 가정합니다. 어떻게해야 awk에서 할 수 있습니까?

답변

10
awk '{print $0>$2".txt"}' file