여러 개의 파일이 존재합니다. 각 파일 안에는 경로명이 저장되어 있는데, 이 파일들에서 공통적으로 등장하는 경로를 찾으려고 합니다. 예를 들어 5개의 파일이 있고 이 파일들 안에 여러 경로들이 저장되어 있는데 /tmp/test.txt라는 경로가 5개의 파일에 모두 등장하는 경우 이 문자열을 찾아내고 싶습니다. 쉘 스크립트로 이게 가능할까요?
파일이 일정한 포맷을 갖고 있다면..
man join
join f1 f2 | join f3 - | join f4 - | join f5 -
되면 한다! / feel no sorrow, feel no pain, feel no hurt, there's nothing gained.. only love will then remain.. 『 Mizz 』
cat f1 f2 f3 f4 f5 | sort | uniq -c | grep "5"
음...
파일이 일정한 포맷을 갖고 있다면..
man join
join f1 f2 | join f3 - | join f4 - | join f5 -
되면 한다! / feel no sorrow, feel no pain, feel no hurt, there's nothing gained.. only love will then remain.. 『 Mizz 』
되면 한다! / feel no sorrow, feel no pain, feel no hurt, there's nothing gained.. only love will then remain.. 『 Mizz 』
아니면...
cat f1 f2 f3 f4 f5 | sort | uniq -c | grep "5"
되면 한다! / feel no sorrow, feel no pain, feel no hurt, there's nothing gained.. only love will then remain.. 『 Mizz 』
되면 한다! / feel no sorrow, feel no pain, feel no hurt, there's nothing gained.. only love will then remain.. 『 Mizz 』