The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Producing visually pleasant documents from plain text with reStructuredText and rst2a iBot UNIX and Linux RSS News 0 04-29-2008 04:40 AM
Plain Text printing issues fender177 Linux 0 10-30-2007 11:14 AM
Plain Unix Certification for oracle developers systemsb UNIX for Dummies Questions & Answers 1 07-18-2006 11:46 AM
My screen saver for a plain session Blooper Shell Programming and Scripting 0 01-09-2006 01:44 PM
email from root sent my passord in plain text. rocker40 AIX 4 05-22-2004 10:10 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-19-2003
bi89676 bi89676 is offline
Registered User
  
 

Join Date: Dec 2003
Posts: 5
RE?? or plain old matching?

Hi,

I need to get filenames without an extension using an ls command. is there a way to do that?

for example.
I want to get: abc_123_ggg
but not: abc_123_ggg.TXT

Anything would be appreciated.
  #2 (permalink)  
Old 12-19-2003
RTM's Avatar
RTM RTM is offline Forum Advisor  
Hog Hunter
  
 

Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
Probably not what you wanted but it does work.

$ ls abc_123_ggg
  #3 (permalink)  
Old 12-19-2003
bi89676 bi89676 is offline
Registered User
  
 

Join Date: Dec 2003
Posts: 5
Thanks for the reply, but yea, that's not what i wanted.

there are hundreds of files, and i need the file name for all of them that does not have the extension.

thanks..
  #4 (permalink)  
Old 12-19-2003
RTM's Avatar
RTM RTM is offline Forum Advisor  
Hog Hunter
  
 

Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
Give examples of the file names -

If they are all the same length (files with and without extensions) then you can do a listing with a wildcard ? (instead of *).

example: all files have 8 characters and then the .ext

$ ls ???????

will only give you files with 8 characters (it does not care what those characters are)

If you pipe output from the ls command to grep, you can also find what you are looking for:

$ ls -1 *|grep -v \[.\]

ls in one column - search and show only lines not containing .

Last edited by RTM; 12-19-2003 at 12:20 PM..
  #5 (permalink)  
Old 12-19-2003
Ygor's Avatar
Ygor Ygor is offline Forum Staff  
Moderator
  
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,407
ls !(*.*)
  #6 (permalink)  
Old 12-19-2003
bi89676 bi89676 is offline
Registered User
  
 

Join Date: Dec 2003
Posts: 5
Many Thanks RTM.

is there a way to do this without using grep?

and no, the filenames are not with the same name.

the ideal way i can do this is:
$ ls not *.txt = to find everything not end with .txt

Thanks.
  #7 (permalink)  
Old 12-19-2003
bi89676 bi89676 is offline
Registered User
  
 

Join Date: Dec 2003
Posts: 5
taking this a step further...
can i view the files without an extension from another location?

ie.
$ more /directory/aaaa/*

but that will display everyfile. I only want to read the ones without the .txt extension?

possible?

Thank you.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:07 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0