------------------------------------------------------------------------
Command: {} (Brace expansion)
------------------------------------------------------------------------

There are two distinct uses of {} (braces) in UNIX. One is to gang
up a list of commands which can then be run in the current shell.
The other use is "brace expansion" -- the topic of this section.
The brace expansion of UNIX is one of my favorites. There are two
types of brace expansions: simple and sequence. 

NOTE: {} produces sequences that is horizontal. Sometimes you need
a column output. In this case use printf and brace exansion (see
end notes).


I. SYNTAX
$ echo File{A,B}	#sequence of alphabets
FileA FileB

$ echo File{A..D}
FileA FileB FileC FileD

$ touch {a,b,c}.dat     #can be post-fix
$ ls *.dat
a.dat b.dat c.dat

$ echo {C..A}   #can go backwards
C B A 

$ echo {1..5}	#sequence of numbers
1 2 3 4 5

$ echo {5..1}	#can go backwards
5 4 3 2 1

II. USAGE

$ echo file{,.bak}	#clever usage
$ cp file{,.bak}  	#copies file to file.bak

	#I wanted to get all six lectures in one go
	#voila 
$ wget http://nptel.ac.in/courses/115101003/downloads/module1/lecture{1..6}.pdf

III. RULES 

There are two rules for brace expansion: (1) even a single blank
prevents expansion of the brace; (2) there has to be at least two
entries separated by a comma; otherwise the lone entry is simply
exactly that, a string.  

$ echo {1..3}
1 2 3

$ echo {1..3 }
{1..3 }

$ echo {1.. 3}
{1.. 3}

$ echo help{me,you}
helpme helpyou

$ echo help{,you}
help helpyou

$ echo help{ ,you}
help{ ,you}

$ echo help{me, you}
help{me, you}


IV. SEQUENCES GALORE: 

e.g. This feature can be used to create a large number of directories
with a definite tree structure, say year-month (to store music or
activities undertaken during those periods).


		#wow, you can nest braces!
$ echo {2001..2003}_{1..2}     #year and month
2001_1 2001_2 2002_1 2002_2 2003_1 2003_2

	#using xargs you can create the entire directory structure
	#to store your pictures by year and month
$ echo {2001..2002}_{1..2} | xargs mkdir	#wow!!



------------------------------------------------------------------------
producing column output
------------------------------------------------------------------------
{} produces a row ouput. Sometimes you need a column output.

$ printf "%s\n" {a..c}
a
b
c


Note: Starting bash 4.0 new features are possible

$ echo {1..10..2}	#2 is the increment
$ echo {a..z..3}	#increment ascii values  << does not work for me