How to assign each line in a text to an array in shell scripting? -


i have text file named "raj.txt" containing following content:


raj magesh popey ravi


how can assign each word array element? a[0]=raj a[1]=magesh a[2]=popey a[3]=ravi

try bash:

while ifs= read -r line    set -- $line    echo "$1"    echo "$2" done < file 

Comments

Popular posts from this blog

c - CUDA code not processing if block properly -

oracle11g - get root domain from url Oracle sql regex_substr -

xcode - Swift Playground - Files are not readable -