<p style="margin-top:.5em;margin-bottom:.9em;font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;line-height:17.0240001678467px;">안녕하세요. 이제 막 bash를 공부중인 뉴비입니다.</p> <p style="margin-top:.5em;margin-bottom:.9em;font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;line-height:17.0240001678467px;">KPDL에도 올리기는 했는데요.</p> <p style="margin-top:.5em;margin-bottom:.9em;font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;line-height:17.0240001678467px;">너무 기초적인거라 답변이 달릴지 어쩔지 몰라 오유에도 글을 올립니다.</p> <p style="margin-top:.5em;margin-bottom:.9em;font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;line-height:17.0240001678467px;"><br></p> <p style="margin-top:.5em;margin-bottom:.9em;font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;line-height:17.0240001678467px;">아래와 같이 file1_list, file2_dat 를 test.sh 에 $1, $2로 집어넣고 file3_result를 뽑을려고 하는데요.</p> <p style="margin-top:.5em;margin-bottom:.9em;font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;line-height:17.0240001678467px;">$1.tmp가 생성이 안됩니다.</p> <p style="margin-top:.5em;margin-bottom:.9em;font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;line-height:17.0240001678467px;">더구나 밑의 sed 명령어도 제가 잘 이해를 못하고 있어서 도움이 필요합니다. 꾸벅</p> <p style="margin-top:.5em;margin-bottom:.9em;font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;line-height:17.0240001678467px;">file1_list<br>###########################<br>A2b42<br>C23nk<br>E6l43</p> <p style="margin-top:.5em;margin-bottom:.9em;font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;line-height:17.0240001678467px;">file2_data<br>###########################<br>A2b42<br>234050402403950<br>B4n2k<br>309785630476028<br>C23nk<br>930293084759842<br>D3m4l<br>429073984762304<br>E6l43<br>233094820938559<br>G4450<br>537867848578940</p> <p style="margin-top:.5em;margin-bottom:.9em;font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;line-height:17.0240001678467px;">file3_result<br>###########################<br>A2b42<br>234050402403950<br>C23nk<br>930293084759842<br>E6l43<br>233094820938559</p> <p style="margin-top:.5em;margin-bottom:.9em;font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;line-height:17.0240001678467px;">test.sh file1_list file2_data<br>###########################</p> <p style="margin-top:.5em;margin-bottom:.9em;font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;line-height:17.0240001678467px;">#!/bin/bash</p> <p style="margin-top:.5em;margin-bottom:.9em;font-family:Verdana, Arial, Helvetica, sans-serif;font-size:12px;line-height:17.0240001678467px;">ct=0<br>for line in $1<br>do<br>echo $line<br>echo "$line" >> file3_result<br>let ct+=1<br>echo $ct<br>grep -n $line > $1.tmp<br>sed s/:[a-z A-Z 0-9]*//g $1.tmp > $1.tmp<br>for line in $1.tmp<br>do<br>fw=$line<br>let $fw+=1 <br>head -n $fw | tail -n 1 >> file3_result<br>done<br>rm *.tmp<br>done<br>echo $ct"line moved"</p>
댓글 분란 또는 분쟁 때문에 전체 댓글이 블라인드 처리되었습니다.