Bash read file to an array based on two delimiters -


i have file need parse array want brief portion of each line , first 84 lines. line maybe:

>mt gi... 

and want mt entered array. other times might this:

>gl000207.1 dn... 

and need gl000207.1

i thinking might able set 2 delimiters (one being '>' , other being ' ' whitespace) not sure how go it. have read other peoples posts internal field separator not sure of how work. think perhaps might work though?

desiredarray=$(echo file.whatever | tr ">" " ") x in $desiredarray    echo > $x done 

any suggestions?

how about:

head -84 <file> | awk '{print $1}' | tr -d '>' 

head takes first lines of file, awk strips off first space , after it, , tr gets rid of '>'.


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -