Double Delight Sale: Flat 70% + Addl. 30% Off + 30-days Extra Lab on all Courses | Use Coupon DS30 in Checkout | Offer Expires InEnroll Now
Check the Data using the
cat command. Since the file is big, you can use
more to see pagewise
cat /cxldata/big.txt | more
Replace space with newline such that every line in output contains only single word:
cat /cxldata/big.txt | sed 's/ /\n/g' |more
For example, after replacing space with a new line in "I am ok" we should get:
I am ok
The "/g" is an option of
sed which makes replace all occurrences of space instead of only one.
Also, note this command has three programs connected by two pipes. The output of the
cat is going to
sed and the output of
sed is going to
more to see the pagewise.
We can sort the words using sort command in the following way
cat /cxldata/big.txt | sed 's/ /\n/g' | sort|more
Note that we are using the
more command just to avoid screen-blindness (too much text scrolling).
We can now, count the words using
cat /cxldata/big.txt | sed 's/ /\n/g' | sort|uniq -c|more
Please save the result of the command to a file
word_count_results in your home directory
cat /cxldata/big.txt | sed 's/ /\n/g' | sort|uniq -c > word_count_results
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