Hello everyone.
Does anyone know how to answer “How many unique names are there in banana?” in Linux CLI Basic?
I have tried everything still can’t solve it
did u got answer if got can u tell i have used this command to get answer sort banana | uniq | wc -l
it showed 22 but still it saying wrong can any one help
Hi @Aylia @MuteWasp4316 Where abouts are you both seeing this question? Can you let us know which module and which task?
Its the Challenge Exercise
it shows me 11 and its still wrong
So sort banana is correct and uniq is correct. Notice when you sort banana there is a blank space in the file. Thus wc -l (count lines) will give the wrong answer, but wc -w (count words) should work.
@JosephWhite Thanks for the explanation. I’ve just done the exercise challenge and did this command “sort banana | uniq -c”. Of course, it will sort and list the words but not mention how many unique words are listed. . I had to cound them. And of course, if you have a long list, it will be impractical to use that command.
I got 21.
Used the sort command