Homework: Make a one-line Unix command - using pipe(s)


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Homework: Make a one-line Unix command - using pipe(s)
# 1  
Old 07-09-2011
Homework: Make a one-line Unix command - using pipe(s)

Task A: Make a one-line Unix command - using pipe(s) - to display the number of files in your home directory including the hidden files that begin with '.'

Task B:Make a one-line Unix command - using pipe(s) - to display the number of unique zip codes in famous.dat (hint: use -u on sort)

Task C: Using the fixed length field file called famous.dat, make a one-line Unix command - using pipe(s) - to display an alphabetical list of the last and first names in upper case of the last 8 people in the file. Hint: Names are in columns 6 through 35. Make the output will look like this...

DARWIN CHARLES
EINSTEIN ALBERT
GALILEO GALILELI
GOLDMAN EMMA
LOVELACE ADA
MANDELA NELSON
PARKS ROSA
RUSSELL BERTRAND

Task D: Using the fixed length field file called famous.dat, make a one-line Unix command - using pipe(s) - to display a list of last name, first name and zip only. Sort first on the zip code, then on last name when there are duplicate zip codes. To save on amount of output produced, just display the first 15 lines of the output from the above, as the last command in the pipe. Hint: zip codes are in columns 44 through 48.

Task E: Write a one-line Unix command using pipes, to display just the current day of the week in lower case (i.e. mon, tue, etc.). Hint: Cut the first part of the date command then pipe to tr.




Yes it's my homework but It's confusingSmilie even when i'm reading the materials for each task. If anyone can help me that'll be awesome.
# 2  
Old 07-09-2011
Do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in this forum under special homework rules.

Please review the rules, which you agreed to when you registered, if you have not already done so.

More-than-likely, posting homework in the main forums has resulting in a forum infraction. If you did not post homework, please explain the company you work for and the nature of the problem you are working on.

If you did post homework in the main forums, please review the guidelines for posting homework and repost.

Thank You.

The UNIX and Linux Forums.
This User Gave Thanks to Neo For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

One Line Command how to use pipe statements to execute and comment on multiple possible outcomes

Hello Forum, I'm looking to expand the following command: INACTIVE_KERNELS=$(python -mplatform | grep -qi red && rpm -qa | grep '^kernel-' |grep -vE `uname -r` | paste -sd \; || echo "Not Red Hat Server") Currently this command will check if my server is RedHat server using the grep -qi... (6 Replies)
Discussion started by: greavette
6 Replies

2. Homework & Coursework Questions

Make a file accept only two arguments from the command line

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: 1) The script is executed in the Korn shell. 2) Name the shell script file is asg6s. 3) The asg6s file is... (7 Replies)
Discussion started by: ProgMan2015
7 Replies

3. Programming

Make a file accept only two arguments from the command line

DELETED (2 Replies)
Discussion started by: ProgMan2015
2 Replies

4. Shell Programming and Scripting

sed command to replace a line in a file using line number from the output of a pipe.

Sed command to replace a line in a file using line number from the output of a pipe. Is it possible to replace a whole line piped from someother command into a file at paritcular line... here is some basic execution flow.. the line number is 412 lineNo=412 Now i have a line... (1 Reply)
Discussion started by: vivek d r
1 Replies

5. Shell Programming and Scripting

How to make command line interactive?

I have a file with stats for different month, I use the cat and grep combination to search for different month. cat <file> | grep "April" cat <file> | grep "May" cat <file> | grep "June" etc. How do you make this command interactive. So that I can give the values for the search. Thanks... (7 Replies)
Discussion started by: purelltab
7 Replies

6. Homework & Coursework Questions

I need to make a script that has 4 command line arguments to function properly.

I have no idea what the following means. The teacher is too advanced for me to understand fully. We literally went from running a few commands over the last few months to starting shell scripting. I am not a programmer, I am more hardware oriented. I wish I knew what this question was asking... (3 Replies)
Discussion started by: Wookard
3 Replies

7. UNIX for Advanced & Expert Users

unix command pipe

I am pretty new to UNIX. My client has a requirement where in a directory we have some files with somewhat similar name like test_XX.txt, test_XY.txt, test_XZ.txt, test_ZZ.txt, test_ZY.txt, test_ZX.txt, test_YY.txt......Out of these files few files have 0 bytes. Is there a way where we can go... (7 Replies)
Discussion started by: RubinPat
7 Replies

8. UNIX for Dummies Questions & Answers

pipe output to script as command line argument

i want to redirect output of one command as the command line argument of another script for example, say i would run this command: find . -xdev -type f -size +4096 -exec ls -al {} \; i wan to be able to do something like: echo +4096 | find . -xdev -type f -size ****** -exec... (3 Replies)
Discussion started by: IMTheNachoMan
3 Replies

9. Linux

how to enable #ifdef macro in the command line of make?

Linux, C++, make, macro In source code, we used some #ifdef macros. How can I enable #ifdef macro in the command line of "make" (NOTE: I do NOT want to change source code or makefile to define that macro from time to time). e.g. test.cpp: ... #ifdef TEST1 // code segment for test1 ...... (3 Replies)
Discussion started by: princelinux
3 Replies

10. UNIX for Dummies Questions & Answers

exit status of command in a pipe line

Hi, I am trying to test the exit status of the cleartool lsvtree statement below, but it doesn't seem to be working due to the tail pipe, which it is testing instead. Is there a way around this without adding a tonne of new code? cleartool lsvtree $testlocation/$exe_name | tail -15 ... (10 Replies)
Discussion started by: topcat8
10 Replies
Login or Register to Ask a Question