bash sorting in a loop error -


i trying sort bunch of files in bash loop numerically (option -n) according second column (option -k 2):

for ch_perm in {0..99};     ch_set in {1..15};          sort -nk 2 $ch_perm.results.$ch_set > sortedbyscore2/$ch_perm.results.$ch_set ;      done done 

but sort won't work correctly. know? in advance!

this output get:

for ch_perm in {0..99}; > ch_set in {1..15};  >  display 1504 possibilities? (y or n) 11.results.21   13.results.35   15.results.49   3.results.61    5.results.74    7.results.88 [...]  >  -k 2 $ch_set.results.$ch_perm > sortedbyscore2/$ch_set.results.$ch_perm ;  > done > done -bash: -k: command not found -bash: -k: command not found -bash: -k: command not found (many many times) 

you have used tabs indent script, confusing bash when paste terminal, , end triggering bash's autocomplete double tab. can see "sort" has been lost when happened.

indent spaces, or put script in file , run there.


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -