SlideShare a Scribd company logo
1 of 1
Download to read offline
unix classes
Task 3 (20 points)
Write a bash program sort.sh to sort a list by frequency in descending order. Your script should
take in a filename as an argument. Here is an example:>hb117@uxb4:~$ cat names.txt
Hoang
Leo
Thuy
Henry
Hoang
Leo
Henry
Hoang
Leo
Henry
Hoang
Leo
Leo
hb117@uxb4:~$ ./sort.sh names.txt
Leo
Hoang
Henry
Thuy
Solution
To sort the content in ascending order.
Sort | uniq names.txt
To sort the content in descending order.
Sort - r | uniq names.txt

More Related Content

More from arrowit1

A plant has a unique photosynthetic plagment. The leaves of this pl.pdf
A plant has a unique photosynthetic plagment. The leaves of this pl.pdfA plant has a unique photosynthetic plagment. The leaves of this pl.pdf
A plant has a unique photosynthetic plagment. The leaves of this pl.pdfarrowit1
 
____ 1. Lymph nodules found in the ileum____ 2. Responsible for bi.pdf
____ 1. Lymph nodules found in the ileum____ 2. Responsible for bi.pdf____ 1. Lymph nodules found in the ileum____ 2. Responsible for bi.pdf
____ 1. Lymph nodules found in the ileum____ 2. Responsible for bi.pdfarrowit1
 
Write the correct master horizon designation (e.g. A, E, etc.) for t.pdf
Write the correct master horizon designation (e.g. A, E, etc.) for t.pdfWrite the correct master horizon designation (e.g. A, E, etc.) for t.pdf
Write the correct master horizon designation (e.g. A, E, etc.) for t.pdfarrowit1
 
SQL FILE FROM MOODLEUSE [master]GO Object Databa.pdf
SQL FILE FROM MOODLEUSE [master]GO Object Databa.pdfSQL FILE FROM MOODLEUSE [master]GO Object Databa.pdf
SQL FILE FROM MOODLEUSE [master]GO Object Databa.pdfarrowit1
 
Which of the following statements most accurately reflects the effec.pdf
Which of the following statements most accurately reflects the effec.pdfWhich of the following statements most accurately reflects the effec.pdf
Which of the following statements most accurately reflects the effec.pdfarrowit1
 
Which of the following is (are) a primary focus of public health inf.pdf
Which of the following is (are) a primary focus of public health inf.pdfWhich of the following is (are) a primary focus of public health inf.pdf
Which of the following is (are) a primary focus of public health inf.pdfarrowit1
 
Which of the following is NOT an activity of descriptive epidemiology.pdf
Which of the following is NOT an activity of descriptive epidemiology.pdfWhich of the following is NOT an activity of descriptive epidemiology.pdf
Which of the following is NOT an activity of descriptive epidemiology.pdfarrowit1
 
What is the view of General Billy Mitchell about ‘air power’Sol.pdf
What is the view of General Billy Mitchell about ‘air power’Sol.pdfWhat is the view of General Billy Mitchell about ‘air power’Sol.pdf
What is the view of General Billy Mitchell about ‘air power’Sol.pdfarrowit1
 
what additional component associated with outer skin epithelium is n.pdf
what additional component associated with outer skin epithelium is n.pdfwhat additional component associated with outer skin epithelium is n.pdf
what additional component associated with outer skin epithelium is n.pdfarrowit1
 
What is the effect of this function below, assuming that a is an .pdf
What is the effect of this function below, assuming that a is an .pdfWhat is the effect of this function below, assuming that a is an .pdf
What is the effect of this function below, assuming that a is an .pdfarrowit1
 
Reference Health Law and EthicsAnalyze the impact the affordable c.pdf
Reference Health Law and EthicsAnalyze the impact the affordable c.pdfReference Health Law and EthicsAnalyze the impact the affordable c.pdf
Reference Health Law and EthicsAnalyze the impact the affordable c.pdfarrowit1
 
Record the results for the hematocrits. Identify the hematocrit that .pdf
Record the results for the hematocrits. Identify the hematocrit that .pdfRecord the results for the hematocrits. Identify the hematocrit that .pdf
Record the results for the hematocrits. Identify the hematocrit that .pdfarrowit1
 
Prepare a witten financial analysis. .This should include calculation.pdf
Prepare a witten financial analysis. .This should include calculation.pdfPrepare a witten financial analysis. .This should include calculation.pdf
Prepare a witten financial analysis. .This should include calculation.pdfarrowit1
 
6. The larger the difference in the electronegativities of two atoms.pdf
6. The larger the difference in the electronegativities of two atoms.pdf6. The larger the difference in the electronegativities of two atoms.pdf
6. The larger the difference in the electronegativities of two atoms.pdfarrowit1
 
Contrast constructive dividends and stock dividends. Explain the tax.pdf
Contrast constructive dividends and stock dividends. Explain the tax.pdfContrast constructive dividends and stock dividends. Explain the tax.pdf
Contrast constructive dividends and stock dividends. Explain the tax.pdfarrowit1
 
10. Give an explanation of the pedigree below SolutionAns The .pdf
10. Give an explanation of the pedigree below SolutionAns The .pdf10. Give an explanation of the pedigree below SolutionAns The .pdf
10. Give an explanation of the pedigree below SolutionAns The .pdfarrowit1
 
4. (TCO 9) Provide a detailed description of the techniques used to .pdf
4. (TCO 9) Provide a detailed description of the techniques used to .pdf4. (TCO 9) Provide a detailed description of the techniques used to .pdf
4. (TCO 9) Provide a detailed description of the techniques used to .pdfarrowit1
 
11. Which of the following statements is true a) Hydrophobic bonds .pdf
11. Which of the following statements is true a) Hydrophobic bonds .pdf11. Which of the following statements is true a) Hydrophobic bonds .pdf
11. Which of the following statements is true a) Hydrophobic bonds .pdfarrowit1
 
Correctly match the name with the contribution. James Lind G a John S.pdf
Correctly match the name with the contribution. James Lind G a John S.pdfCorrectly match the name with the contribution. James Lind G a John S.pdf
Correctly match the name with the contribution. James Lind G a John S.pdfarrowit1
 
8. What are the different kinds of risk in finance.SolutionRis.pdf
8. What are the different kinds of risk in finance.SolutionRis.pdf8. What are the different kinds of risk in finance.SolutionRis.pdf
8. What are the different kinds of risk in finance.SolutionRis.pdfarrowit1
 

More from arrowit1 (20)

A plant has a unique photosynthetic plagment. The leaves of this pl.pdf
A plant has a unique photosynthetic plagment. The leaves of this pl.pdfA plant has a unique photosynthetic plagment. The leaves of this pl.pdf
A plant has a unique photosynthetic plagment. The leaves of this pl.pdf
 
____ 1. Lymph nodules found in the ileum____ 2. Responsible for bi.pdf
____ 1. Lymph nodules found in the ileum____ 2. Responsible for bi.pdf____ 1. Lymph nodules found in the ileum____ 2. Responsible for bi.pdf
____ 1. Lymph nodules found in the ileum____ 2. Responsible for bi.pdf
 
Write the correct master horizon designation (e.g. A, E, etc.) for t.pdf
Write the correct master horizon designation (e.g. A, E, etc.) for t.pdfWrite the correct master horizon designation (e.g. A, E, etc.) for t.pdf
Write the correct master horizon designation (e.g. A, E, etc.) for t.pdf
 
SQL FILE FROM MOODLEUSE [master]GO Object Databa.pdf
SQL FILE FROM MOODLEUSE [master]GO Object Databa.pdfSQL FILE FROM MOODLEUSE [master]GO Object Databa.pdf
SQL FILE FROM MOODLEUSE [master]GO Object Databa.pdf
 
Which of the following statements most accurately reflects the effec.pdf
Which of the following statements most accurately reflects the effec.pdfWhich of the following statements most accurately reflects the effec.pdf
Which of the following statements most accurately reflects the effec.pdf
 
Which of the following is (are) a primary focus of public health inf.pdf
Which of the following is (are) a primary focus of public health inf.pdfWhich of the following is (are) a primary focus of public health inf.pdf
Which of the following is (are) a primary focus of public health inf.pdf
 
Which of the following is NOT an activity of descriptive epidemiology.pdf
Which of the following is NOT an activity of descriptive epidemiology.pdfWhich of the following is NOT an activity of descriptive epidemiology.pdf
Which of the following is NOT an activity of descriptive epidemiology.pdf
 
What is the view of General Billy Mitchell about ‘air power’Sol.pdf
What is the view of General Billy Mitchell about ‘air power’Sol.pdfWhat is the view of General Billy Mitchell about ‘air power’Sol.pdf
What is the view of General Billy Mitchell about ‘air power’Sol.pdf
 
what additional component associated with outer skin epithelium is n.pdf
what additional component associated with outer skin epithelium is n.pdfwhat additional component associated with outer skin epithelium is n.pdf
what additional component associated with outer skin epithelium is n.pdf
 
What is the effect of this function below, assuming that a is an .pdf
What is the effect of this function below, assuming that a is an .pdfWhat is the effect of this function below, assuming that a is an .pdf
What is the effect of this function below, assuming that a is an .pdf
 
Reference Health Law and EthicsAnalyze the impact the affordable c.pdf
Reference Health Law and EthicsAnalyze the impact the affordable c.pdfReference Health Law and EthicsAnalyze the impact the affordable c.pdf
Reference Health Law and EthicsAnalyze the impact the affordable c.pdf
 
Record the results for the hematocrits. Identify the hematocrit that .pdf
Record the results for the hematocrits. Identify the hematocrit that .pdfRecord the results for the hematocrits. Identify the hematocrit that .pdf
Record the results for the hematocrits. Identify the hematocrit that .pdf
 
Prepare a witten financial analysis. .This should include calculation.pdf
Prepare a witten financial analysis. .This should include calculation.pdfPrepare a witten financial analysis. .This should include calculation.pdf
Prepare a witten financial analysis. .This should include calculation.pdf
 
6. The larger the difference in the electronegativities of two atoms.pdf
6. The larger the difference in the electronegativities of two atoms.pdf6. The larger the difference in the electronegativities of two atoms.pdf
6. The larger the difference in the electronegativities of two atoms.pdf
 
Contrast constructive dividends and stock dividends. Explain the tax.pdf
Contrast constructive dividends and stock dividends. Explain the tax.pdfContrast constructive dividends and stock dividends. Explain the tax.pdf
Contrast constructive dividends and stock dividends. Explain the tax.pdf
 
10. Give an explanation of the pedigree below SolutionAns The .pdf
10. Give an explanation of the pedigree below SolutionAns The .pdf10. Give an explanation of the pedigree below SolutionAns The .pdf
10. Give an explanation of the pedigree below SolutionAns The .pdf
 
4. (TCO 9) Provide a detailed description of the techniques used to .pdf
4. (TCO 9) Provide a detailed description of the techniques used to .pdf4. (TCO 9) Provide a detailed description of the techniques used to .pdf
4. (TCO 9) Provide a detailed description of the techniques used to .pdf
 
11. Which of the following statements is true a) Hydrophobic bonds .pdf
11. Which of the following statements is true a) Hydrophobic bonds .pdf11. Which of the following statements is true a) Hydrophobic bonds .pdf
11. Which of the following statements is true a) Hydrophobic bonds .pdf
 
Correctly match the name with the contribution. James Lind G a John S.pdf
Correctly match the name with the contribution. James Lind G a John S.pdfCorrectly match the name with the contribution. James Lind G a John S.pdf
Correctly match the name with the contribution. James Lind G a John S.pdf
 
8. What are the different kinds of risk in finance.SolutionRis.pdf
8. What are the different kinds of risk in finance.SolutionRis.pdf8. What are the different kinds of risk in finance.SolutionRis.pdf
8. What are the different kinds of risk in finance.SolutionRis.pdf
 

Recently uploaded

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701bronxfugly43
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxcallscotland1987
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxAmanpreet Kaur
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 

Recently uploaded (20)

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 

unix classesTask 3 (20 points)Write a bash program sort.sh to so.pdf

  • 1. unix classes Task 3 (20 points) Write a bash program sort.sh to sort a list by frequency in descending order. Your script should take in a filename as an argument. Here is an example:>hb117@uxb4:~$ cat names.txt Hoang Leo Thuy Henry Hoang Leo Henry Hoang Leo Henry Hoang Leo Leo hb117@uxb4:~$ ./sort.sh names.txt Leo Hoang Henry Thuy Solution To sort the content in ascending order. Sort | uniq names.txt To sort the content in descending order. Sort - r | uniq names.txt