Help with pipes command
Hi all, I am new to this site. I am new Linux. I am working on my assignment and trying to figure out how to come out with a command using pipes. Below is the question.
"Write a command using pipes that displays all of the entries in the /etc/password file that contain the string grunix. Write a similar command that does not use pipes. Thanks |
Hi,
This sure does look like homework.... We are willing to help, but won't do the assignment for you. What have you tried so far? And what did/didn't work? |
Hello and Welcome to LinuxQuestions,
LQ users are not in the habit of doing your homework for you. You'll learn a lot more by doing it yourself. Of course if you encounter problems or errors you can always turn to us for help and advice. If you show us what you have done already we might give you some pointers. In the meanwhile you can have a look at Google and do a search for some online documentation, for example this one. Kind regards, Eric Beaten by druuna :) |
Since this is a school assignment, don't expect to get any help. Learn on your own.
Edit: Beaten by druuna and erictra. |
Thanks for the responses. I guess i might not have worded my question well. What I need help is understanding the string grunix I know about the pipe redirection tool, but I am confused as to what the string "grunix" means and how it is supposed to execute.
Thanks |
Hello,
A string is just a combination of characters, in this case to be used with a tool to catch the instances of that string you encounter in the password file. Have a look into grep: Code:
man grep Eric |
To add to that, also look into awk.
Code:
man awk |
Quote:
Code:
jabam@ubuntu:~$ grep jabam /etc/passwd |
Hi,
Grep takes a file as input (the way you do it in post #8), grep also accepts input from a pipe. cat the file and pipe it to grep: cat file | grep "string" Hope this helps. |
Quote:
|
Hi,
Glad you got a solution. If you consider your problem/question solved then please mark it as such using the Thread Tools. Kind regards, Eric |
Hi,
Quote:
|
All times are GMT -5. The time now is 11:25 PM. |