I am trying to find all the files which are not the *.o (object) files and store in file MyFile.lst in the current directory Tree.
I am doing it from using below command.
#! /usr/bin/ksh
find . -type f | grep -v "*.o" >> MyFile.lst
For some reason it is not working please help me.
Edit:
find . -type f | grep -v '\.o$' >> MyFile.lst
Seems like working. Any comment/ suggestion.(added keith.layne correction)
You don’t need
grep.In grep, the searching pattern should be a regular expression. Therefore,
.,$and*are having special meaning.grep -v '\.o$'would match files with.oextension. (You need to escape.for its literal meaning).