I tried to use a sed command to extract alphanumberic names, one per line, from a file which also included comments (line starts with '#') and blank lines. I wanted to refer to each in a loop.
I tried for MACHINE in `sed '/^[0-9A-Za-z][0-9A-Za-z]*/' ~/MPI-SRC/machine_names.txt` a little awkward because sed has no '+' to indicate "at least one alphanumeric".
I got an error that there was no command given to sed. I thought it printed by default.
I tried for MACHINE in `sed '/^[0-9A-Za-z][0-9A-Za-z]*/p' ~/MPI-SRC/machine_names.txt` and it printed all the names twice.
Finally, I had to use
for MACHINE in `sed -n '/^[0-9A-Za-z][0-9A-Za-z]*/p' ~/MPI-SRC/machine_names.txt`
to suppress one copy.
Why do I get "double or nothing"?