I have a file which contains items like this
3456=lsop sds fds,firstname.lastname@example.org,email@example.com
now i need to extract 4 variables 1st before "=" sign, 2nd after equal sign and comma and third after 1st coma and 2nd coma and 4th after last coma. Also there is a possibility that 4th coma doesn't exists.
I have loop which read the file line by line and extract 1st 4 character, now i need email address(es) in that loop so i can process them. I have tried while IFS=',' but don't know how to store them in variables?
Thanks in advance for the help
I have Code like this which works fine, but i wanna do it with clean way.
while read line; do
code1=`echo $line | cut -c -4`
echo "Code1 :" $code1
echo $line > /tmp/tmp_lines_file
while IFS=, read garb email1 email2
echo "Garbage:" $garb
echo "Email Address1" $email1
echo "Email Address2" $email2
done < /tmp/tmp_lines_file
done < MyFile.txt