//View Tip #481
» Change extension on a group of files using only bash builtins an
» Change prompt color dynamically
» Bash
» Version all unversioned files in an SVN checkout
Mitzekotze
Similar Tips
» Splitting arguments with read» Change extension on a group of files using only bash builtins an
» Change prompt color dynamically
» Bash
» Version all unversioned files in an SVN checkout
Latest tips by RSS
Click here to subscribe
Follow Shell-Fu on Twitter
Click here to follow
Follow Shell-Fu on identi.ca
Click here to follow
Like <TAB> expands a filename given a prefix you can also expand a file name given the middle part of a file name using escape and then 'g'.
Which will expand to:
$ ls abc1def abc2def abc3def abc4def abc5def $ ls *2*<ESC>g
Which will expand to:
$ ls abc2def
Comments
Add your comment
#1
Hey thanks for sharing this hint.
Posted 2009-01-13 16:53:24
But it only expand if there is one file in the regex, for example:
$ touch test1.txt test2.txt test3.txt
$ ls test*txt<ESC>g
It doesn't expand nothing :-/
$ ls test1*txt
This example works.. Tested on BASH 2 and 3.. --Santi
$ touch test1.txt test2.txt test3.txt
$ ls test*txt<ESC>g
It doesn't expand nothing :-/
$ ls test1*txt
This example works.. Tested on BASH 2 and 3.. --Santi
Posted 2009-01-15 09:38:04

