We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
uniq -c puts 6 spaces infront of output, but do not use cut -c7- with it to clean the output as these spaces are reserved for the count of lines. If the count exceeds 9 -c7- would only give unit place of the count. use sed 's/^[[:space:]]*//g' its more robust
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
'Uniq' command #3
You are viewing a single comment's thread. Return to all comments →
uniq -c
puts 6 spaces infront of output, but do not usecut -c7-
with it to clean the output as these spaces are reserved for the count of lines. If the count exceeds 9-c7-
would only give unit place of the count. usesed 's/^[[:space:]]*//g'
its more robust