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:
I'm trying to use a loop to get to the following result:
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:
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.