You are not logged in.
Pages: 1
Hi there,
After updating yesterday everything was fine, but today i noticed that whenever i use the grep command, it doesn't do anything.... i mean it doens't output anything.
For example, if i type:
$ grep hello
the cursor just keeps blinking forever and shows no output so i have to Ctrl+C or Ctrl+Z to stop the process
by mere curiosity i used the 'type' command
$ type grep
and got this output:
grep is hashed (/usr/bin/grep)
i have no idea what this could be... any help will be appreciated ![]()
Last edited by tatay99 (2016-10-13 00:49:29)
Offline
See man grep
grep helloWon't do anything. There is no file or input to search.
Examples:
grep hello file.txt
ip addr | grep lo
ps -e | grep gvfs
echo "hello" | grep -o hOffline
Well it will do something - it will accept any input lines you type, and it will echo back those that contain the word hello. It will continue to do so until it gets an EOF (Ctrl-D) or is killed. But yes, this question seems to stem from a misuse/misundertanding of grep.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
[...] or Ctrl+Z to stop the process
Note that ^Z will not stop the process, just suspend it (you can lists suspended/backgrounded jobs for a shell with the `jobs` command).
You can then either use `fg` or `bg` to continue the process in the foreground or background (this article might help you understand that).
Offline
Guys i'm so embarrassed...i've read your comments and as 'Trilby' said, it was a misunderstanding i had regarding the grep command... next time i will read carefully the man pages before asking any dumb question. Anyway thaks for your support and advises, i appreciate it
i'll go and read the article ayekat suggested ![]()
Offline
And don't forget to mark your thread as [SOLVED]
Offline
Pages: 1