little help in unix

suppose i have filename for example

ExcessiveMissingReadsReport.log

i want only the file name i,e ExcessiveMissingReadsReport and not ExcessiveMissingReadsReport.log

ls -ltr *.log---------gives all the filename which having .log.......but i want the part r name before .log

ls -1 *.log | cut -d "." -f1

thanks a lot dear, i got the answer. but some files are like reapeted like

ImportAdapter.log

ImportAdapter.AI.log

ImportAdapter.IntervalReads.log

even i want files ImportAdapter.AI and also ImportAdapter.IntervalReads and like wise........

this command showing me only ImportAdapter

ls -1 *.log | cut -d "." -f1

how to retrieve all filename .log

ls *.rar|sed 's/\.log$//g'

You can try something like this :

for file in `ls *.log`;do echo ${file%.*};done

Try basename

will break if log files have spaces (although OP may not require)

# touch "log file with spaces.log"
# for file in `ls *.log`;do echo ${file%.*};done
log
file
with
spaces

modified:

# for file in "`ls *.log`";do echo "${file%.*}";done
log file with spaces

or use shell expansion

# for file in *log;do echo "${file%.*}";done
log file with spaces

Great!Good catch
Thanks for your comments

thanks for all ur replies,i apprriciate it

this command works fine

ls *.log|sed 's/\.log$//g'

how to put this command in for loop

for i in *.log*
do
ls *.log|sed 's/\.log$//g'
echo "____________________________"
done

i m not getting where to put $i in this command so that it can retrieve single file one by one

you are already "expanding" the file patterns in your for loop's *.log* . Therefore you do not need to use ls inside the for loop anymore.
just echo the "i" to sed.


for i in *.log*
do
 echo $i | sed 's/\.log$//g'
done

another way

ls *.log|sed 's/\.log$//g' | while read file
do
  echo "file is $file"
done

i have this script

#!/bin/ksh

for i in *.log*
do
c2=0

c2=`ls $i|sed 's/\.log.//g'`
ls $i | grep -w $c2 | while read file
do
echo "file $file is Running" >> lls.txt
echo "
*********************************************************">>lls.txt
done

------------------------------------------------------------------------

and the output are:

file ImportAdapter.MRMSPreRead is Running
***********************************************************************************************************
file ImportAdapter.MRMSPreRead.log.1 is Running
***********************************************************************************************************
file ImportAdapter.MRMSPreRead.log.2 is Running
-------------------------------------------------------------------

why last 2 files are coming.only 1st file should be displayed na ?

how to eliminate last 2 types of file......see here all the files are having same name before .log

i just want the name of file and not .log.1 and .log.2 etc