Hi All,
I am new to scripting. I need your help to removing spaces from a string and assign them to different variables.
Iwant to call script with one command line argument which is file name which containes different attributes their type and different values eg
fdxE1ConfigAdminStatus int 1 2
fdxE1LineType int 1 2 3
.
.
.
Now I want script take one line every time from this file then in that line it will go till end and puts value in different attributes eg
attr1 = fdxE1ConfigAdminStatus
attr2 = int
attr3 = 1 and 2 [possibly an array]
then it goes to second line and do the same and so on
I wrote follwing program
if [ "$1" = "" ]; then
echo "$0 <attr filename >";
exit;
fi
while read line; do
status="";
echo $line;
echo ${#line};
done
First traversal of loop containes fdxE1ConfigAdminStatus int 1 2
Now I want to remove spaces after fdxE1ConfigAdminStatus, int, 1 and 2 and put them in different attributes.
This is bash script.
Could you all please help to me to find out a solution.
Thanks in advance