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
Post a Comment