1753797 Members
7388 Online
108799 Solutions
New Discussion юеВ

Re: help in ls

 
SOLVED
Go to solution
Avery_1
Advisor

help in ls

how to list all the files without extension in Bourne shell?

eg: file.txt file file.c

outputs : file
hey
7 REPLIES 7
Ramkumar Devanathan
Honored Contributor
Solution

Re: help in ls

Hi Sophia,

Just pipe the ls command to the sed one-liner that i'd provided earlier.

ls | sed 's/^\(.*\)\..*/\1/'

That should work -- Or am I mistaken about your requirement(s)?

- ramd.
HPE Software Rocks!
Avery_1
Advisor

Re: help in ls

no..this is another thing i wanna do...last qn and ur answers were great...thanks for every help
hey
Ramkumar Devanathan
Honored Contributor

Re: help in ls

Hi,

what is the requirement exactly?

:)

- ramd.
HPE Software Rocks!
Bill Douglass
Esteemed Contributor

Re: help in ls

ls | grep -v "^.*\."

This will filter out file names with a . in them.
Avery_1
Advisor

Re: help in ls

hi ramd!

that is the exact requirement i'm looking for...thanks lots...if u dun mind...i hav another bourne shell script to solve...i tried so many times to make it works...un4tunately no...

and u too Bill...thanks 4 the help....
hey
Ramkumar Devanathan
Honored Contributor

Re: help in ls

Sophia,

go ahead and pose your query... will it be here or in another post?

preferable to have a new query posted - coz that'll open up the gates to a lot more people.

- ramd.
HPE Software Rocks!
Avery_1
Advisor

Re: help in ls

it is in another post, ramd...it is already there under subject:Bourne shell somethin...somethin
hey