Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part 3 Fill in the blanks. (25 points in total) 1) (6 points) The following shell script mySplit is used to split a large file

image text in transcribedimage text in transcribed

Part 3 Fill in the blanks. (25 points in total) 1) (6 points) The following shell script mySplit is used to split a large file into multiple smaller files on every n lines. The filename of new file is created by putting an index (starting from 1) after the original filename. When running the shell script, the first argument should be the pathname of the file to be split, the second argument should be the value of n For example, file test (in current working directory) has 150 lines, after running command below, two new files test1 and test2 are generated in current working directory. testl has the first 100 lines from test, while test 2 has the remained 50 lines. SmySplit test 100 #!/bin/bash # Get the number of lines in the given file lineCount- awk print 1 # The index of new file starts from 1 newFile Index=1 ; # A new file starts from line n1 n1-1; while [ $nl do $1ineCount ] n2="expr $n1 + $2-1" # The new file ends with line n2 # Extract multiple lines from the given file into the new file sed -n 5 # Updat the start line number for next file n1="expr $n2 + 1 newFileIndex-expr"E 2) (10 points) The following Bourne shell script and C program can accomplish the same task read a character from user's input and check if a character is a VOWEL or CONSONANT while ignoring case sensitive A sample of the output is like below Piease enter a character: E E is a VOWEL Shell script C program # ! /bin/bash include echo "Enter a character:" read int main() char ch; then printf ("Enter a character: "); scanf ( case $ch in echo " $ch is a VOWEL" if ( //check for VOWEL or CONSONANT switch (ch) esac fi

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Spatio Temporal Database Management International Workshop Stdbm 99 Edinburgh Scotland September 10 11 1999 Proceedings Lncs 1678

Authors: Michael H. Bohlen ,Christian S. Jensen ,Michel O. Scholl

1999th Edition

3540664017, 978-3540664017

More Books

Students also viewed these Databases questions

Question

Question May I set up a Keogh plan in addition to an IRA?

Answered: 1 week ago