Search for file extensions in the given directories


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Search for file extensions in the given directories
# 1  
Old 06-11-2012
Search for file extensions in the given directories

Hey guys,

I'm lost... I need to make a script that will work in this way:

./script.sh -e sh /usr/bin /home/student

this script will result in this output:

amuFormat.sh /usr/bin
gettext.sh /urs/bin
perfect.sh /home/student

the parameter -e <ext> gives you which extension you need to look for
This parameter is followed by all the directories where you need to search for the file extension. The output will then give you the name of the files, followed by the directory in which the file was found...

I really need your help Smilie
# 2  
Old 06-11-2012
Do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in this forum under special homework rules.

Please review the rules, which you agreed to when you registered, if you have not already done so.

More-than-likely, posting homework in the main forums has resulting in a forum infraction. If you did not post homework, please explain the company you work for and the nature of the problem you are working on.

If you did post homework in the main forums, please review the guidelines for posting homework and repost.

Thank You.

The UNIX and Linux Forums.
# 3  
Old 06-11-2012
Is this homework?

Edit: Scrutinizer was faster.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to use a grep search to search for a specific string within multiple directories?

Lets say I have a massive directory which is filled with other directories all filled with different c++ scripts and I want a listing of all the scripts that contain the string: "this string". Is there a way to use a grep search for that? I tried: grep -lr "this string" * but I do not... (3 Replies)
Discussion started by: Circuits
3 Replies

2. Shell Programming and Scripting

Search for a file in all directories and place the file in that directory

Hi All, Daily I am getting the updated file. I have to search for this file in all directories and sub directories. If the file existed in a particular directory then move this updated file to that particular directory. If the file is not existed in any of the directories then place this... (4 Replies)
Discussion started by: ROCK_PLSQL
4 Replies

3. Shell Programming and Scripting

Command to Search a FILE for a STRING in multiple DIRECTORIES

Hi, Can someone please help me with a Command to Search a FILE for a STRING in multiple DIRECTORIES. I am searching for the VIP in HTTPD.CONF in multiple httpd instances. I am using find ./ -name "httpd.conf" | xargs grep 10.22.0.141 cut -d: -f3- | cut -d ' ' -f4 | sort | uniq -c ... (1 Reply)
Discussion started by: crosairs
1 Replies

4. UNIX for Advanced & Expert Users

Search file in all directories.

Hi colleagues, I need to search one file in all dierctories, i have O.S. AIX 5.3, my file began with cc, the others caracters i unknow. Then i can to search one string in file in all dierctories. Thank you for advanced. (8 Replies)
Discussion started by: systemoper
8 Replies

5. Shell Programming and Scripting

PERL or SHELL Scrript to search in Directories by taking line by line from a text file

Unix box server version *********** >uname -r B.11.00 >echo $SHELL /usr/bin/ksh --> in this server, I have the path like /IMbuild/dev/im0serv1 ---> in that directory I have the folders startup(.jsp files nearly 100 jsp's ) and scripts(contains .js files nearly 100 files) ... (9 Replies)
Discussion started by: pasam
9 Replies

6. UNIX and Linux Applications

Perl Script to read an excel file into an array and search in the UNIX directories

Hi, I want the Perl script with versions 5.8.2 and 5.8.5 starting with #!/usr/bin/perl The Perl program should read the excel file or text file line by line and taking into an array and search in the UNIX directories for reference file of .jsp or .js or .xsl with path .The Object names... (2 Replies)
Discussion started by: pasam
2 Replies

7. Shell Programming and Scripting

How to search through directories and sub dir

Im working on a project that basically imitates the find and whereis commands. The program will take in a file name or regular expression and, starting with the current directory search downwards and match any files with that pattern and prints the path name. I don't understand how to do this... (5 Replies)
Discussion started by: new2C
5 Replies

8. UNIX for Dummies Questions & Answers

Batch Renaming: Change files' extensions in many sub-directories

Hi all - I'm trying to rename a large number of files all at once and need some help figuring out the command line syntax to do it. I've already done quite a bit of research with the rename and mv commands, but so far haven't found a solution that seems to work for me. So: The files exist... (10 Replies)
Discussion started by: dave920
10 Replies

9. UNIX for Dummies Questions & Answers

awk search and print .doc extensions

Hello, I'm trying to grab all lines in a file that match the extension using the following command: awk '/.doc/' Input.csv > WordFiles.dat This works, but if a line contains "doc" it still prints the line. I want to print only the lines with ".doc" Can someone show how to pick up only... (1 Reply)
Discussion started by: orahi001
1 Replies

10. Shell Programming and Scripting

how to search directories

Hello everybody, i'm dummy for unix but i want to learn something. i want to search the working directory and its subdirectories( all ) to find the files which are more than 1024 bytes. So which commands must i learn? Thanks to all. (13 Replies)
Discussion started by: redbeard_06
13 Replies
Login or Register to Ask a Question