I have a .txt file that contains a text like this
A1/B1/C1
A2/B2/C2
A3/B3/C3
I want a script that reads the .txt file for each line then create a directory based on the first word (A1, A2, A3)
I have created script like this:
file="test.txt"
while IFS='' read -r line
do
name="line"
mkdir -p $line
done <"$file"
While I run it, it creates directory A1 then it also create sub-directories B1 and C1. the same happens for another line (A2* and A3*)
What should I do to create only A1, A2, A3 directories?
I don't want to make the name like A1/B1/C1 with '/' character in it. I just want to take the word before '/' character and make it directory name. Just "A1" "A2" "A3".