Solved

grep problem

Posted on 1997-06-09
3
454 Views
Last Modified: 2010-04-21
How can I obtain the item number X from a line returned by the command grep?
0
Comment
Question by:jjescri
3 Comments
 
LVL 22

Expert Comment

by:blu
ID: 2006384
Huh?  Please give an example.
0
 
LVL 1

Accepted Solution

by:
henrys earned 0 total points
ID: 2006385
pipe output of grep to awk
For example, to get the process ID from a `ps` listing:
% ps -ef | grep inetd | awk '{print $2}'  (SysV)
 ps -aux | grep inetd | awk '{print $2}'   (BSD)
0
 

Author Comment

by:jjescri
ID: 2006386
Thank you very much, U.henrys.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Unix Command -- Challenging  question 7 101
Unix/bash: scripted arithmetic 13 102
Solaris acount issues 44 45
how to send mail in unix 2 18
Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question