shell - find and grep command this but not that -


I am trying to find all the files that are *. O (object) files are not stored and stored in the MyFile.lst file in the current directory tree.

I am using this command.

  #! / Usr / bin / ksh search-type F | Grep -v "* .o" & gt; & Gt;  

Edit:

  find-type F | Grep -v '\ .o $' & gt; & Gt; MyFile.lst   

Looks like no comment / suggestions. (Added keith.layne correction)

You do not need grep . Search Type 'F!' -name '* .o' & gt; & Gt; MyFile.lst

In GRP, search patterns should be a regular expression. Therefore, . , $ and * have special meaning.

 . That means match any character, it means that the line X * means the match matches the end of X, zero or more times (greedy)   

Grep -v '\ .o $ " .o will match the files with the extension. (You need to avoid the for your code. ) .

Comments

Popular posts from this blog

php - Creating canonical URLs with custom route-classes -

mysql - Formatting problem with PHP DateTime Difference when used as part of an equation -

Mysql Local server hardware -