I know the title sounds a little confusing, but hopefully my example will clarify my issue.
So I have a file with a list of names (names.txt), for example:
john
david
richard
I'm trying to use a loop to get to the following result:
john john.doe
david david.doe
richard richard.doe
Not sure if using sed is the right command or approach, but here's what I've tried:
for i in $(cat names.txt); do sed "s/$/ $i.doe/" names.txt; done
This 'sort of' works, but spits out an iterative list like this instead:
john john.doe
david john.doe
richard john.doe
john david.doe
david david.doe
richard david.doe
john richard.doe
david richard.doe
richard richard.doe
I've also tried a while IFS= read -r loop as well with similar results. Can't seem to just deal with each line without resulting above.
I'm likely completely off the mark here, but hoping someone can help here.
Apologies in advance. I've used sed before but for rather easier tasks.