O what the heck, its close to new years, ill give you the solution in a silver plate , but dont get used to it. Run this command on your file sed 's/~/,/' myfile.txt | awk -F"\," '{for(i=2;i<=NF;i++) print $1,"~",$i }' > NewFile.txt Your task: Study it and tell ...