Double Delight Sale: Flat 70% + Addl. 30% Off + 30-days Extra Lab on all Courses | Use Coupon DS30 in Checkout | Offer Expires InEnroll Now
A shell script is a file which contains the commands separated by a newline.
Let's create a script to do the sorting of the data:
Create a file using nano text editor:
The first line of a script should have
#! followed by the name of the program to execute the script with. Since we are creating a shell script, we want it to be executed using
bash. So, the first line of the program should be:
Add the command in the editor:
tr 'A-Z' 'a-z'| sed -E 's/[ \t]+/\n/g'|sed 's/[^0-9a-z]//g' | sort|uniq -c|sort -nr -S 50M
Save the file by pressing
Now, make this file executable:
chmod +x wordcountscript.sh
Check if it is running:
cat /cxldata/big.txt | ./wordcountscript.sh | more
./ means current directory and
| more will show the result pagewise instead of causing too much scrolling.
Also, note that whatever is the input to the script is also passed to the programs executed in the script.
Taking you to the next exercise in seconds...
No hints are availble for this assesment
Answer is not availble for this assesment
Note - Having trouble with the assessment engine? Follow the steps listed here