I'm trying to seperate the ip and port using a bash script. Below is what I have
my proxies.txt file
48.54.87.45:1000
48.54.87.45:1001
48.54.87.45:1002
My bash script
#!/bin/sh
input="proxies.txt"
while IFS= read -r var
do
echo "$var"
IFS=':' read proxy port <<< "$var"
echo "$proxy"
echo "$port"
echo "---------------"
done < "$input"
But I get the following error
Syntax error: redirection unexpected
I have tested the loop and it does read the file one by one. It's the IFS
line which is giving the error.
What have I done wrong?