read line by line from text file but no repeat with bash -


1,bash content:

#!/bin/bash file="/home/zjhxmjl/desktop/111" while read -r line;do     sed "s/$/$line/" xiaoxiequanpin.lst >> quanpin_8shenri     sed -i 's/ //g' quanpin_8shenri     tr -d '\r'< quanpin_8shenri > quanpin_8shenri.new     tr -s ' '< quanpin_8shenri.new > quanpin_8shenri.newest     mv quanpin_8shenri.newest quanpin_8shenri.lst done <"$file" 

2,file "111"(location /home/zjhxmjl/desktop/) content:

19800101 19800102 

3,xiaoxiequanpin.lst content:

aaa bbb 

4,file "quanpin_8shenri.lst" result:

aaa19800101 bbb19800101 aaa19800101 bbb19800101 aaa19800102 bbb19800102 

5,i want result:

aaa19800101 bbb19800101 aaa19800102 bbb19800102 

so can give me advance?

pipe result sort , uniq:

someprocess | sort | uniq 

edit

or simply:

someprocess | sort -u 

Comments