LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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, 05:21 PM   #1
ash997
LQ Newbie
 
Registered: Jun 2018
Posts: 23

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, 05:27 PM   #2
RandomTroll
Senior Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 1,959

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

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, 06:01 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,125

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

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, 06:34 PM   #6
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
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, 06:38 PM   #7
ash997
LQ Newbie
 
Registered: Jun 2018
Posts: 23

Original Poster
Rep: Reputation: Disabled
The class is Linux 1 and I don't know what language.
 
Old 06-14-2018, 06:58 PM   #8
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

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

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

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
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-14-2018, 11:48 PM   #11
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
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



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 08:21 PM
Make list of files which contains IP jojanmpaul Linux - Newbie 4 06-06-2014 05:00 AM
how to make link list and add and delete list node in shared memory golden_boy615 Programming 1 12-18-2011 06:52 AM
how do I make a sensible list from a directory structure? oskar Linux - General 2 06-25-2008 12:27 PM
how to make a filename make list and feed it to the tar utility nass Slackware 9 09-25-2007 11:51 AM

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

All times are GMT -5. The time now is 04:15 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
Open Source Consulting | Domain Registration