I need to create a tool to tokenize an input list. I would be providing a text file containing a list of subdomains in the following manner:
abc.xyc.kkk.com
hjk.pol.lll.kkk.com
...
And the output need to be :
abc
xyz
kkk
hjk
...
The delimiter is '.
'
I have tried out the following code, which does not seem to be working:
#!/bin/bash
STRING= cat $1
IFS='.' read -ra VALUES <<< "$STRING"
## To print all values
for i in "${VALUES[@]}"; do
echo $i
done