How to use IFS to get output of range in comma separator in bash?

beer9 used Ask the Experts™
I would like to have output like below,,,,,,,,,

Open in new window

which I am able to get from below command in bash

$printf '%s,' ns{2..10}.com,,,,,,,,,

Open in new window

I am wondering if I can get something like this using IFS (Internal Field Separator) in bash

something like
IFS=, ns{2..10}.com

Open in new window

which obviously doesn't work. Appreciate any suggestion :-)
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Software Engineer
Distinguished Expert 2018
IFS means Input Field Separator and can be used for splitting fields...
Like so:
 printf '%s,' ns{2..10}.com | (IFS=, read a b c d e f ; echo $a / $b / $c / $d / $e / $f )

Yielding: / / / / /,,,,

So what are you trying to accomplish exactly?
Most Valuable Expert 2013
Top Expert 2013

Usually shell builtins do not take IFS/OFS settings into account, at least bash's brace expansion definitely doesn't.

In order to avoid the comma at the end you could try this:

echo  ns{2..10}.com | tr " " ","

As I said, no chance with IFS, unfortunately!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial