Log In
|
Sign Up
Search
command-line beautifier
Writer
오창민
Description
## 적용 버전: 5.0 이상 .bashrc에 아래와 같은 함수를 만들어서, curl search API 함수 호출 출력에 pipe로 연결하면 예쁘게(?) 포맷팅된 검색 결과 확인 가능: ``` function beautify() { KVM= if [ -x ./kvm.new ]; then KVM=./kvm.new elif [ -x ./kvm ]; then KVM=./kvm fi if [ -z "$KVM" ]; then echo "beautify: cannot find 'kvm'."; exit -1; fi $KVM -x "string buf; list
aa; while ((n=fgets(buf,stdin))>=0) {if (n==0) {printz beautify(''.join(aa));break;}; aa.append(buf);}" } ``` - 기존 ``` $ curl "http://localhost:8520/search?select=title&from=vv.sample&where=title%3d'여행'+allword+synonym+order+by+\$relevance+desc" {"result":{"total_count":3, "rows":[{"fields":{"title":"정부, 이스라엘
여행
자제요청"}, "sortkey":["268438781"], "location":{"rowid":907, "volume":"sample", "table":"sample", "netaddr":"127.0.0.1:8520"}, "copyof":-1}, {"fields":{"title":"[국제금융 르네상스 시대-LG카드] 세계
여행
땐 무료보험 제공"}, "sortkey":["268438776"], "location":{"rowid":253, "volume":"sample", "table":"sample", "netaddr":"127.0.0.1:8520"}, "copyof":-1}, {"fields":{"title":"월드컵 특수 항공·관광 손달린다"}, "sortkey":["0"], "location":{"rowid":413, "volume":"sample", "table":"sample", "netaddr":"127.0.0.1:8520"}, "copyof":-1}]}, "message":"", "status":"OK"} ``` - beautify pipe 연결 ``` $ curl "http://localhost:8520/search?select=title&from=vv.sample&where=title%3d'여행'+allword+synonym+order+by+\$relevance+desc"|beautify % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 698 100 698 0 0 40349 0 --:--:-- --:--:-- --:--:-- 41058 {"result":{ "total_count":3, "rows":[ {"fields":{ "title":"정부, 이스라엘
여행
자제요청"}, "sortkey":[ "268438781"], "location":{ "rowid":907, "volume":"sample", "table":"sample", "netaddr":"127.0.0.1:8520"}, "copyof":-1}, {"fields":{ "title":"[국제금융 르네상스 시대-LG카드] 세계
여행
땐 무료보험 제공"}, "sortkey":[ "268438776"], "location":{ "rowid":253, "volume":"sample", "table":"sample", "netaddr":"127.0.0.1:8520"}, "copyof":-1}, {"fields":{ "title":"월드컵 특수 항공·관광 손달린다"}, "sortkey":[ "0"], "location":{ "rowid":413, "volume":"sample", "table":"sample", "netaddr":"127.0.0.1:8520"}, "copyof":-1}]}, "message":"", "status":"OK"} ```
Tag
beautify kvm curl search
Module Name
Attachments
Comments
Save
Save
Cancel
Save
Cancel
Warning
Login