Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

write those scripts in linux 4 ) Delete all duplicate files Write a shell script to deleteDuplicate that deletes all files ( Keep one and

write those scripts in linux 4) Delete all duplicate files
Write a shell script to deleteDuplicate that deletes all files (Keep one and remove the other) that are a copy of a
given file. The command deletes replication f1 f2... fn should remove all the files f2 through fn that are exact
copies of f1. Exact means that the file name and size are the same.
Sample:
(Assume that the midterm file in directory dir1 has another copy inside directory dir2)
./deleteDuplication dir1 dir2
File midterm has been deleted from the dir2 directory.
...
If there arent two arguments or dir1 and dir2 are not a directory, the script should print an appropriate error message
to stderr and exit.
3. Report:
5) Count and display all files that contain the exact word:
Write a countWord script that accepts as many arguments as possible (up to 8): the word to search for and a list
of directories. The script should display all files with their directories.
Your script should print an error if:
The first argument is not a type of regular file
The number of arguments is less than two.
Sample:
./countWord Computer Comp311 Comp433 Comp438
The Word Computer appears 4 times in the following Files with the
corresponding lines
/Comp311/midterm.doc line 10
/Comp311/resume.txt line 5
/Comp433/technology.txt. line 3
/Comp438/Myfiles.html line 25
6) Count the number of files that have the same name inside different directories.
Write a countFiles script that accepts two directories as arguments: the script should display all files with the
same name.
Your script should print an error if:
the first argument is not a type of directories
the number of arguments is not equal to two.
Sample:
./countFiles Comp311 Comp2311
The following files appear in the directories Comp311 and Comp2311
Hello.java
Test.c
Final.html
dont use find or compare commands

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

When is the deadline?

Answered: 1 week ago