Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 04-22-2004, 07:51 PM   #1
Registered: Mar 2004
Location: USA
Distribution: Redhat Linux 9
Posts: 98

Rep: Reputation: 15
grep question

Is the following correct to find the string /dev/lp0 in the current directory?

grep "/dev/lp0"

Also after this the system seems to be searching, but it seems to be a very long time.
Next did the following:

Ctrl C:

Then issued the command:

kill 4817

(4817 was the pid of "grep" found using the "ps" command)
"kill" cmd did not terminate the "grep" cmd.

can you help me in this please?
Thank you.
Old 04-22-2004, 09:06 PM   #2
Registered: Mar 2004
Location: bursa
Posts: 110

Rep: Reputation: 15
You need to give grep a file argument, or pipe it something, or do a recursive (-r) search in a directory (eg. . or /etc/rc.d).

The way you're doing it now causes grep to wait for input on stdin. Try typing "/dev/lp0"; grep should spit the line back at you, as it matches . Probably not what you want.
Old 04-22-2004, 11:50 PM   #3
Senior Member
Registered: Jan 2004
Location: Oregon, USA
Distribution: Slackware
Posts: 1,246

Rep: Reputation: 59
If you want to search for the string "/dev/lp0" in a file in the current directory then do this:

grep "/dev/lp0" *
Old 04-23-2004, 01:32 AM   #4
Registered: Mar 2004
Location: USA
Distribution: Redhat Linux 9
Posts: 98

Original Poster
Rep: Reputation: 15
Thank you.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
grep question djgerbavore Linux - Newbie 3 11-04-2004 11:53 AM
Question about Grep irfanhab Linux - Newbie 6 08-23-2004 03:57 PM
grep question djgerbavore Linux - Newbie 7 07-07-2004 08:11 AM
grep question Hockeyfan Linux - General 1 05-15-2004 03:09 AM
grep question keyops Programming 2 04-09-2004 10:17 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:12 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration