제가 스크립트를 짜려고 하는데...
예를들어 1.txt 라는 파일 안에
111.222.333.444 555.666.777.888 123.456.789.000
이런식으로 아이피가 있다고 하면요 이 텍스트 파일을 가지고 /cat/etc/hosts 호스트 파일에 검색을해서 >2.txt 으로 떨구는 스크립트를 만들고 싶습니다..
2.txt 에는 호스트만 나왔으면 좋겠네요 ㅜ
도와주세용 ㅜㅜ
https://kldp.org/node/143341
소곤소곤
$ cat 1.txt 127.0.0.1 $ cat /etc/hosts # # /etc/hosts: static lookup table for host names # #<ip-address> <hostname.domain.org> <hostname> 127.0.0.1 localhost.localdomain localhost local ::1 localhost.localdomain localhost local # End of file $ join -o 2.2 <(sort 1.txt) <(sort /etc/hosts) > 2.txt $ cat 2.txt localhost.localdomain
크게 다르지 않다고 봅니다.
https://kldp.org/node/143341
소곤소곤
$ cat 1.txt127.0.0.1$ cat