If you are working in the shell
ls ?c*
is all that it takes.
Question
How can I do that? Do I have to use regular expressions?
To clarify, let's say I have the following files in a directory: abc.sh acb.sh example.c bob.php - and I want to list the ones which has 'c' as second letter (i.e. acb.sh).
Thanks!
Solution
If you are working in the shell
ls ?c*
is all that it takes.
OTHER TIPS
What about
ls ?c*
I guess it will do.. question mark stands for single character.
ls | grep "^.c"
Also works, here ^ indicates beginning of line, so ^. says match any single character at beginning and then match c.
Also you can use find
command:
find ./ -name "?c*.*"
ls . | grep '^.c'
where .
represents the present working directory
or
find / -type d -exec grep '^.c' {};
or
find / -type d | grep '^.c'