unix script-report the number of SQL files

March 14, 2012 at 14:52:39
Specs: Windows 7
Unix script to report the number of SQL files in home directory

See More: unix script-report the number of SQL files

Report •


#1
March 14, 2012 at 15:06:43

cd $HOME
find . -type f -name "*.sql" -print|wc -l

Report •

#2
March 14, 2012 at 17:17:49
how about using grep?

Report •

#3
March 15, 2012 at 07:28:10
Maybe, but please elaborate on what consititutes a "SQL file"? I assumed an file with an sql extension was what you were searching for.

Report •

Related Solutions

#4
March 15, 2012 at 14:43:16
SQL FILE- file names that end in .sql...
How would i use grep within this?

Report •

#5
March 15, 2012 at 16:50:02
Why would you want to use grep when it isn't needed? Because your instructor told you to? :)

I suppose you could do something silly and find all the files in the home directory and then use grep to only look at files that end in .sql:

cd $HOME
find . -type f -print|grep .sql$|wc -l

Depending on your Unix version, you may have to use egrep if grep does not work.


Report •

Ask Question