Friday, 15 August 2014

linux - How to write a program called biggest that takes any number of arguments -



linux - How to write a program called biggest that takes any number of arguments -

so trying write programme called biggest takes number of arguments. arguments files, finds file words in it, , prints line such as:

file whatever has largest number of words (37)

assuming file called "whatever" has 37 words, more (or same) other files in current directory. if no arguments valid files, next line should printed stderr: biggest: no valid filenames specified

the wc command seems useful, wc –w

please guide me more help!!

thanks

put next in script , enjoy :

for i; wc -w $i; done | sort -n | tail -1 | cutting -d' ' -f2

ps: no 1 wants help when don't help yourself. me timepass ;-)

linux bash shell dash

No comments:

Post a Comment