How to list files with no extension together with *.prog files?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How to list files with no extension together with *.prog files?
# 1  
Old 07-18-2011
How to list files with no extension together with *.prog files?

Hi,

I know that to list files with no extension, we can use..

Code:
ls -1 | grep -v "\."

And to list .prog files, we can use..

Code:
ls -1 *.prog

or

Code:
ls -1 | grep '.prog$'

What if I wanted a single ls command that will display both? How can I do it?

Please note that I need the -1 in ls as per requirement. I'm not using Unix directly but a 3rd party application that executes the ls -1. Then I just concatenate any additional parameters or commands after it.

Thanks.
# 2  
Old 07-19-2011
Try...
Code:
shopt -s extglob
ls !(*.*) *.prog

This User Gave Thanks to Ygor For This Post:
# 3  
Old 07-19-2011
I'll try this and see if our 3rd party tool supports it.

Thanks.
# 4  
Old 07-19-2011
if not, then

Code:
find . -iname '*.prog' -o -not -name '*.*'

# 5  
Old 11-25-2011
I tried using
Code:
 find . | grep -v "\."

to list the files with no extension but its not working. Instead of 'find' if I give 'ls' it works fine. My requirement is to using it with 'find' command.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Display the .csv extension files based on .done extension fine

Hi All, I want to fetch the files based on .done file and display the .csv files and Wil take .csv files for processing. 1.I need to display the .done files from the directory. 2.next i need to search for the .Csv files based on .done file.then move .csv files for the one directory ... (2 Replies)
Discussion started by: girija.g6
2 Replies

2. Shell Programming and Scripting

Python - glob () - How to grep same files with different extension files

Hi I Have a directory and i have some files below abc.txt abc.gif gtee.txt ghod.pid umni.log unmi.tar How can use glob function to grep abc files , i have created a variable "text" and i assigned value as "abc", please suggest me how can we use glob.glob( ) to get the output as below... (2 Replies)
Discussion started by: kumar85shiv
2 Replies

3. Red Hat

How to rename files to files with mv extension?

currently in my directories $ ls -lrth total 32K -rw-r--r-- 1 oracle oinstall 864 Feb 25 16:01 cor_bin_gateway_cnt.sql -rw-r--r-- 1 oracle oinstall 782 Feb 25 16:01 mer_bin_gateway_cnt.sql I want to rename files with *.sql to *.mv extension, but when I execute the following $ mv... (1 Reply)
Discussion started by: jediwannabe
1 Replies

4. Shell Programming and Scripting

List files with *.i extension in a directory and all its subdirectories + 30days old then remove

I need to write a script to : list files with *.i extension in a directory and all its subdirectories + 30days old, save it in a file and then remove (2 Replies)
Discussion started by: lena keung
2 Replies

5. UNIX for Dummies Questions & Answers

How do I delete all files except one of a certain extension?

Let's say I wanna Delete all the files of a certain extension exept one. How do I do it? I know, if you wanna delete them all is with the command: find ~/ -type f -iname '*.txt' -exec rm {} ~/ ';' But If I want to keep an Specific file? Let's say I wanna keep 'Log.txt'. How do I do it? (1 Reply)
Discussion started by: lsteamer
1 Replies

6. UNIX for Dummies Questions & Answers

How to get size of a list of files with specified extension?

Command ls -l *cpp lists all cpp program files in a directory. It shows the size of each file. Using a calculator to work out the total size of the cpp files would be very tedious. Is there a way to get the total size from the command line? (5 Replies)
Discussion started by: resander
5 Replies

7. UNIX for Dummies Questions & Answers

How to compress files without extension

Could someone please help? I'm trying to compress all the files in a directory without extension. I know for typical files with extension, the command is something like: tar -zcvf file.tar.gz *.doc What is the command for files without extension? Thanks. (4 Replies)
Discussion started by: AChan1118
4 Replies

8. HP-UX

Files without extension

I am brand new to hp unix systems. I see some files without extension on this system. If I type name of the file it shows me so many detail but does not take me back to command prompt. What are these files and how do I come back to command prompt? Please help (1 Reply)
Discussion started by: rajahindustani
1 Replies

9. Shell Programming and Scripting

How to get files with a specific extension

Hi All, How do I get only the files with the .csv extension. I have a shell script something like below: #!/usr/bin/ #Directory to scan for files SCANDIR="/cmb/data/exstream/scriptslogs/"; LOGFILE="/cmb/data/exstream/scriptslogs/test.log"; cd $SCANDIR for FILE in * ; do FILENAME=$FILE... (9 Replies)
Discussion started by: janavenki
9 Replies

10. UNIX for Dummies Questions & Answers

How to list files will no extension

Can some one help ...... I want to list files with no extension in directory. I have tried the following ls * That listed all files ls *.* That listed files with extension ls That listed all files Thanks (5 Replies)
Discussion started by: Wing m. Cheng
5 Replies
Login or Register to Ask a Question