LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-14-2018, 06:21 PM   #1
ash997
LQ Newbie
 
Registered: Jun 2018
Posts: 14

Rep: Reputation: Disabled
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
 
Old 06-14-2018, 06:27 PM   #2
RandomTroll
Senior Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 1,009

Rep: Reputation: 164Reputation: 164
Looks like homework. Great band!
 
Old 06-14-2018, 06:42 PM   #3
ash997
LQ Newbie
 
Registered: Jun 2018
Posts: 14

Original Poster
Rep: Reputation: Disabled
I'm thinking that I have to use this command but I'm not sure
<file1 cut -d',' -f4 | sort -n | uniq -c
 
Old 06-14-2018, 07:01 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 17,169

Rep: Reputation: 2628Reputation: 2628Reputation: 2628Reputation: 2628Reputation: 2628Reputation: 2628Reputation: 2628Reputation: 2628Reputation: 2628Reputation: 2628Reputation: 2628
Did you try it ?.
What happened ?.
What was the reason ?.
 
Old 06-14-2018, 07:27 PM   #5
ash997
LQ Newbie
 
Registered: Jun 2018
Posts: 14

Original Poster
Rep: Reputation: Disabled
yes I tried it and I got this -bash: sorn: command not found
-bash: file1: No such file or directory
 
Old 06-14-2018, 07:34 PM   #6
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: MID-SOUTH USA
Distribution: Slackware 14.2 / Slackware 14.2 current / Manjaro / Parrot
Posts: 7,181

Rep: Reputation: 1439Reputation: 1439Reputation: 1439Reputation: 1439Reputation: 1439Reputation: 1439Reputation: 1439Reputation: 1439Reputation: 1439Reputation: 1439
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.
 
Old 06-14-2018, 07:38 PM   #7
ash997
LQ Newbie
 
Registered: Jun 2018
Posts: 14

Original Poster
Rep: Reputation: Disabled
The class is Linux 1 and I don't know what language.
 
Old 06-14-2018, 07:58 PM   #8
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: MID-SOUTH USA
Distribution: Slackware 14.2 / Slackware 14.2 current / Manjaro / Parrot
Posts: 7,181

Rep: Reputation: 1439Reputation: 1439Reputation: 1439Reputation: 1439Reputation: 1439Reputation: 1439Reputation: 1439Reputation: 1439Reputation: 1439Reputation: 1439
Then how is anyone going to be able to help you?
 
Old 06-14-2018, 07:59 PM   #9
ash997
LQ Newbie
 
Registered: Jun 2018
Posts: 14

Original Poster
Rep: Reputation: Disabled
I guess It's bash
 
Old 06-14-2018, 11:53 PM   #10
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 17,169

Rep: Reputation: 2628Reputation: 2628Reputation: 2628Reputation: 2628Reputation: 2628Reputation: 2628Reputation: 2628Reputation: 2628Reputation: 2628Reputation: 2628Reputation: 2628
Quote:
Originally Posted by ash997 View Post
yes I tried it and I got this -bash: sorn: command not found
-bash: file1: No such file or directory
So you got messages and you chose to ignore them ?. And you want use to tell you why ?. Not going to happen.

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.
 
Old 06-15-2018, 12:48 AM   #11
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,480

Rep: Reputation: 997Reputation: 997Reputation: 997Reputation: 997Reputation: 997Reputation: 997Reputation: 997Reputation: 997
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.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Make Linux more professional-The list beachboy2 Linux - General 6 03-13-2016 09:21 PM
Make list of files which contains IP jojanmpaul Linux - Newbie 4 06-06-2014 06:00 AM
how to make link list and add and delete list node in shared memory golden_boy615 Programming 1 12-18-2011 07:52 AM
how do I make a sensible list from a directory structure? oskar Linux - General 2 06-25-2008 01:27 PM
how to make a filename make list and feed it to the tar utility nass Slackware 9 09-25-2007 12:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration