Question

In: Computer Science

this is bash scripting. a. Write a shell script that adds an extension “.deb” to all...

this is bash scripting.

a. Write a shell script that adds an extension “.deb” to all the files in a directory.

b. Write a command sequence or a script to insert a line “GHIJKLM” at every 10th line of a file?

c. Write a bash command or script to find all the files modified in less than 5 days and print the record count of each.

Solutions

Expert Solution

----------------------------------------------------------------------------------------------------------------------

Script to copy:
a) find . -type f -exec mv ‘{}’ ‘{}’ .deb\;

b) awk '{ if(NR==10){ print "GHIJKLM"} print $0}' NAME> NAME

c) find . -mtime -5 | wc -l


Related Solutions

Write a bash shell script that takes exactly one argument, a file name. If the number...
Write a bash shell script that takes exactly one argument, a file name. If the number of arguments is more or less than one, print a usage message. If the argument is not a file name, print another message. For the given file, print on the screen its content.
Write a shell script (to run on the Bourne shell) called cp2.sh to copy all the...
Write a shell script (to run on the Bourne shell) called cp2.sh to copy all the files from two named directories into a new third directory. Timestamps must be preserved while copying files from one directory into another. Task Requirements Three directory names must be supplied as arguments to your script when it is executed by the user. In the beginning of your script you need to check that the first two directory names provided (e.g. dir1 and dir2) exist...
Examine the following shell script and describe its function line-by-line: #! /bin/bash #This script backs up...
Examine the following shell script and describe its function line-by-line: #! /bin/bash #This script backs up the Oracle DB rm -f /SAN/backup-oracle* if tar -zcvf /SAN/backup-oracle- 'date +%F'.tar.gz/oracledb/* then echo "Oracle backup completed on 'date'" >>/var/log/oraclelog else echo "Oracle backup failed on 'date'" >>/var/log/oraclelog mail -s ALERT [email protected] </var/log/oraclelog fi
this is bash scripting. a. Explain the difference between grep and egrep? b. Write a command...
this is bash scripting. a. Explain the difference between grep and egrep? b. Write a command to list files where third letter is x or y? c. Write command to remove array element with id 5
Program in Bash: Write a program using bash script that can read a file from the...
Program in Bash: Write a program using bash script that can read a file from the same directory, sort the nonrepeating integers from 0-9 from smallest to largest, and output the results on the same line. Do not use the sort function.
Program in Bash: Write a program using bash script that can read a file from the...
Program in Bash: Write a program using bash script that can read a file from the same directory, sort the nonrepeating integers from 0-9 from smallest to largest, and output the results on the same line. Do not use the sort function.
Fully Functional Script written in BASH In this section, you will write a fully functional script...
Fully Functional Script written in BASH In this section, you will write a fully functional script to help your manager with an important project that will build upon what you learned from your script work in Milestone Four. After you have written the script, you will execute it to generate a report for all three users (once for Bob, once for Henry, and once for Frank). You should have three unique generated reports in your ~/scripts directory (or more if...
(10pts) Write a shell script to display your name to the screen. (10pts) Write a shell...
(10pts) Write a shell script to display your name to the screen. (10pts) Write a shell script to take a directory as an argument and display the contents of that directory (10pts) Write a shell script that takes any command as a parameter and displays help on that command (e.g. the result of the execution of man <command>). (10pts) Write a shell script that requires two file names as parameters and copies content of one file into another without asking...
Bash script: Create a bash script that takes numbers as parameters, calculates sum and prints the...
Bash script: Create a bash script that takes numbers as parameters, calculates sum and prints the result. If no parameters passed, prompt a user (only one time) to enter numbers to sum and print the result. Submit your program as LastName_FirstName.sh file.
Task: 2.1 : Shell Scripting Task1 :Traditional hello world script Open terminal create Lab01 directory and...
Task: 2.1 : Shell Scripting Task1 :Traditional hello world script Open terminal create Lab01 directory and use cd command to move into the directory Open a new file script hello.sh using vi editor # vi hello.sh Type the following lines #!/bin/bash           echo Hello World     Save the file and return back to terminal How to Runhello.sh Adding Execute Permission Checking current permission        # ls -la hello.sh Adding Execute permission # chmod u+x hello.sh   Check whether execute permission is added # ls...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT