Solved find command to list files with extension of .txt

February 18, 2013 at 17:07:33
Specs: solarias
current command i am using gets all files, .rtp also, i am using
find /utl_file/utl_file/ "^[A-Z]{3}[0-9]{12}\W[txt]" -print | xargs grep -l "UNRESOLVED" > /export/home/elguser/cgk/grep_UNR_TWN_results_txt.txt
need all files containing "UNRESOLVED".
files in directory are named:
ABC201301211013.txt
DEN201302030935.rpt
EDC201302041124.txt

See More: find command to list files with extension of .txt

Report •

#1
February 18, 2013 at 21:55:09
I am not certain what you are trying to do with this regular expression:

"^[A-Z]{3}[0-9]{12}\W[txt]"

but I don't think the Solaris find command supports the number of groupings like {3} or {12} like you are trying to do.

However, this command finds all files starting with 3 alphas, at least one numeric and a "txt" file extension:

find /utl_file/utl_file -type f -name "[A-Z][A-Z][A-Z][0-9]*.txt" -exec grep -l UN
RESOLVED {} \;

You can add as many [0-9] numerics as you wish.

Use find's -exec option to perform the grep.

Let me know if you have any questions.


Report •

#2
February 19, 2013 at 08:01:41
✔ Best Answer
Thank you for the help, i have the find command working with help from your input. I also had to replace the space between the . (period) and the filename. I have it working now and used the following, thanks again!
find ./[A-Z][A-Z][A-Z]201*.txt -type file -xdev -exec grep -l UNRESOLVED_TWIN_OCCURRENCE {} \; > /export/home/elguser/cgk/test.cgk

Report •

#3
July 13, 2013 at 12:40:22
And this one:

ls -1 *.Txt



Report •
Related Solutions


Ask Question