How do I make a list?
I need to make a list of the number of employees working in each department. With the name of each department once and the the number of employees. The file contains the following:
04,Hendrix,James,Engineering,9 889,Wallace,Mia,Accounting,8 096,Uffhark,Joan,Administration,9 120,Carrington,Blake,Accounting,8 053,Draper,Don,Marketing,3 413,Zappa,Francesco,Engineering,9 285,Gunvalson,Victoria,Engineering,9 744,Watts,Charles,Administration,8 409,Wilson,Brian,Engineering,9 346,McCormick,Kenneth,Marketing,2 070,Berlin,Rachel,Marketing,2 555,Zombie,Robert,Administration,7 217,Burns,Fahr,Accounting,8 154,Tennille,Antoinette,Engineering,9 843,Trakand,Elayne,Administration,8 654,Grumby,Jonas,Administration,7 026,Corleone,Michael,Marketing,3 599,March,Christopher,Engineering,9 808,Mann,Yoda,Engineering,9 |
Looks like homework. Great band!
|
I'm thinking that I have to use this command but I'm not sure
<file1 cut -d',' -f4 | sort -n | uniq -c |
Did you try it ?.
What happened ?. What was the reason ?. |
yes I tried it and I got this -bash: sorn: command not found
-bash: file1: No such file or directory |
strut does not work in bash, hum.. what class are you taking? what programming lang is it suppose to be in. else you could just go old school, and use a piece of paper and pencil to write out a list. :D
|
The class is Linux 1 and I don't know what language.
|
Then how is anyone going to be able to help you?
|
I guess It's bash
|
Quote:
Looks like you found that command string somewhere and used it without understanding what it is. Linux comes with a help system for commands called "man" - but only for commands actually installed. So "man sort" (no quotes) will work, but "man sorn" won't for the same reason as in you messages. Use "q" (no quotes) to exit the manpage. Linux is case sensitive as well as expecting you to type names correctly. All this should be provided in a beginner linux course. |
Just a footnote: in my experience, instructors assign homework problems NOT because they don't know the answer, but because the task cannot be performed by students without them actually learning something. By approaching the problem with sound reasoning, and developing a solution based on sound research, the student not only learns how to solve the assigned task, but many other similar problems as well.
It would help us to know what you are starting with and what the result should be. So, could you type out the desired out file so at least 'you' know what you want it to look like? I can tell you that you probably want to look into writing a script using awk and/or sed. I doubt whether you'd be expected to use PERL in your intro class. |
All times are GMT -5. The time now is 02:21 PM. |