List the file with a dot


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting List the file with a dot
# 1  
Old 03-21-2012
List the file with a dot

I am on hp-ux and not able to catch the file with dot using a wild card.

Code:
$ touch .test

Code:
$ ls -l .test
-rw-r--r--   1 oracle     dba              0 Mar 21 05:20 .test


Code:
$ ls -l *test
*test not found

Code:
$ ls -la *test
*test not found


Why i am not able to list the file startign with . (dot) with an wild character *
Moderator's Comments:
Mod Comment How to use code tags

Last edited by Scrutinizer; 04-14-2012 at 05:49 PM..
# 2  
Old 03-21-2012
Code:
ls -la .*test

# 3  
Old 03-21-2012
Just for completeness, files with names starting with a period character are known as "hidden files".
# 4  
Old 04-14-2012
Hi everyone,

I'm by no means an expert on the topic, however it has occured to me that

Code:
ls -la .*test

will not work

because the bash interpreter will decode this as "look for all files that have an extention whose patters is : <any combination >test.

what I'm trying to say is the dot (.) is interpreted here as the extension delimiter. It is not interpreted as "files that are hidden".


I tested ls -la .*test on gentoo linux and it definitely does not return the hidden file called "test".

In my own simplistic way, because I'm not a pro, I worked out the following solution (I'm certain there are better):

Code:
ls -la | grep 'test'

I realise it's listing EVERYTHING and only grabbing whatever has the pattern "test" in it, and this may or may not be what you want, however that's what I was able to summon with my limited knowledge and free time.

Please, I invite you to refine my search.

Last edited by Scrutinizer; 04-14-2012 at 05:50 PM.. Reason: lingo, code tags
# 5  
Old 04-14-2012
@alfonsopilato. Hi, there is not such thing as an extension on Unix. So humans may call it that way, but for the system it is a file with a dot somewhere in the name (a dot at the beginning does have a special meaning of course as it designates a hidden file etc).

Code:
$ touch .test
$ ls -l .*test
-rw-r--r--  1 me       staff  0 Apr 14 22:53 .test


Last edited by Scrutinizer; 04-14-2012 at 06:28 PM..
This User Gave Thanks to Scrutinizer For This Post:
# 6  
Old 04-14-2012
@Scrutinizer, thank you. I have tried ls -l .*test and that works for me now.

Was it the "touch .test " that may have kicked it in?
I have reviewd my command history and reran the command that previously had failed.. it's now working.

Thanks again for clarifying this. I do very much appreciate it.

I'm glad I stated I'm not a pro; truly I'm not.

I'll remember "touch" from now on. :-)
# 7  
Old 04-14-2012
Hi alfonsopilato, welcome to the Unix and Linux forums!
The touch had nothing to do with it, that is just a way to create zero length file if it does not already exist.
This User Gave Thanks to Scrutinizer For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Rename except dot file extension

After reading the manual of the command rename I would like to apply it to a folder with a couple of files containing old style dots before the file-type, e.g. up.to.the.roof.avi. So I'd like to rename them without the dots in between. Therefore I tried it the following way rename -f -n ... (4 Replies)
Discussion started by: 1in10
4 Replies

2. Shell Programming and Scripting

How to remove. (dot) if found in the beginning of file name while doing wget (download)?

Dear All, How to remove. (dot) if found in the beginning of file name while doing wget (download)? I am facing problem while re-sizing the image by using ImageMagick. Two dots in the file name are causing problem. ImageMagick is skipping such image with a dot . in the beginning, like ... (1 Reply)
Discussion started by: Praveen Pandit
1 Replies

3. Shell Programming and Scripting

grep'ing dot history file

Hi, I tried to grep ".sh_history" (DOTsh_history) file and did not return anything though I found the word in .sh _history file through vi editor in Linux. Then I tried to grep ".profile" to check if it is the prob with hidden files and I got results. Then I verified the same with my friend... (4 Replies)
Discussion started by: bobbygsk
4 Replies

4. Shell Programming and Scripting

How to Removing a dot from a file name?

I need a script that will allow me to rename all of my files in subdir /FilesIn as follows: From kumc_835_111200.RMT.dat to kumc_835_111200RMT.dat kumc_835_111200.KMR.dat to kumc_835_111200KMR.dat .................etc How do I do that whithout doing a sed ... (10 Replies)
Discussion started by: mrn6430
10 Replies

5. Shell Programming and Scripting

removing a word in a multiple file starting at the dot extension

hi I would like to ask if someone knows a command or a script on how to rename a multiple file in the directory starting at the end of the filename or at the .extension( i would like to remove the last 11 character before the extension) for example Below is the result of my command ls inside... (5 Replies)
Discussion started by: jao_madn
5 Replies

6. Programming

how to call dot c file using system command

Hi every one, i have to dot pc files. One have main function but one dont have.I have to call dot pc file using system () cmd.File is being call have main function.Please let me know how i can call .pc file with two arguments from other dot pc file.I want some thing like sprintf(buf, "ss_xxx.pc... (4 Replies)
Discussion started by: goraya430
4 Replies

7. Shell Programming and Scripting

how to call dot c file using system command

Hi every one, i have to dot pc files. One have main function but one dont have.I have to call dot pc file using system () cmd.File is being call have main function.Please let me know how i can call .pc file with two arguments from other dot pc file.I want some thing like sprintf(buf,... (1 Reply)
Discussion started by: goraya430
1 Replies

8. Shell Programming and Scripting

use dot file in linux

Hi, I am creating a phonebook to store the name:phone:address.The phonebook is used to store, edit,delete and list the data. Now i need to use text file(dot files) for configuration (saving and loading selections). I really don't know how to do that. Please help thanks.. (6 Replies)
Discussion started by: coolgal
6 Replies

9. UNIX for Dummies Questions & Answers

command to list dot files

hey. i am a bit new to unix and i am trying to figure out how to list the names of the 'dot' files that are in my account. what command does this? thank you very much for your help. (4 Replies)
Discussion started by: Jakeman1086
4 Replies

10. Shell Programming and Scripting

Replace path in a file with dot

Hi, I have a file with below values. /uvxapps/etl/Ascential/DataStage/DSEngine/dsenv.orig /uvxapps/etl/Ascential/DataStage/DSEngine/dsenv /uvxapps/etl/Ascential/DataStage/DSEngine/sample/.cshrc /uvxapps/etl/Ascential/DataStage/DSEngine/sample/.login... (3 Replies)
Discussion started by: njoshi
3 Replies
Login or Register to Ask a Question