Unlock Career Sale: Flat 75% + Addl. 15% Off + 30-days Extra Lab on self-paced Courses | Use Coupon UC15 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.
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