Bash variables

Ummm can anybody help me with this one?

Its prob quite simple.

I bascially have a file name say J1x2x3x7.dat

Im using the file name as a variable in a bash script. Want I want to do is extract most of the file name and make it a new variable expect with say one of the number now a wildcard, so have something like J1x*x3x7.dat as my new file name?

Can this be easily done. I'm sure it can smile.gif ?

Yes, asterisks are permitted in filenames on most UNIX systems. However, using an asterisk in a filename is a really bad idea for lots of reasons and is generally avoided. Note that POSIX filenames cannot contain asterisks.

file=J1x2x3x7.dat
newfile=J1x*x3x7.dat
mv "$file" "$newfile"

However, be aware that such a filename can cause problems.

See the POSIX standard for portable filenames:
General Concepts: Filenames
Definitions: Portable Filename Character Set