grep command

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers grep command
# 1  
Hammer & Screwdriver grep command

I'd like to use grep command to filter something from all the directories that above my directory.
How do I do that?
I tried 'grep something ./*' but I didn't get anything which I knew there is something inside one of the subdirectory.


Last edited by whatisthis; 09-02-2004 at 12:29 PM..
# 2  
You didn't say which version of Unix you have but this works on a lot of them:
grep -R "searchstring" *

The -R option calls grep for all of the usb-directories
# 3  

How do I know which version I am using?

I tried grep -R something but it didn't work.
# 4  
If it's gnu grep then "grep --version" will work (to find the version number, that is).

If it's not gnu grep, and -R (or -r) do not work, then you could use find and xargs

find /path/to/parent/dir | xargs grep "something"


Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #841
Difficulty: Medium
Push technology, or server push, is a style of Internet-based communication where the request for a given transaction is initiated by the publisher or central server.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Grep command giving different result for different users for same command

Hello, I am running below command as root user #nodetool cfstats tests | grep "Memtable switch count" Memtable switch count: 12 Where as when I try to run same command as another user it gives different result. #su -l zabbix -s /bin/bash -c "nodetool cfstats tests | grep "Memtable switch... (10 Replies)
Discussion started by: Pushpraj
10 Replies

2. UNIX for Dummies Questions & Answers

grep command

Not sure what I'm doing wrong here???? Trying to execute a grep command within a unix script and keep getting an error. Here is an example of the process I'm trying to execute a="\"JERRY SMITH\""; b="/u/tmp/filea"; x=`grep -c $a $b`; echo $x; Execute script and this is what I get...... (3 Replies)
Discussion started by: macastor
3 Replies

3. Shell Programming and Scripting

Help with using grep command with copy command

Hi, im taking an entry Unix class, and as part of my lab assignment I have to copy all files in the /home/david/lab3 directory that have the file extension .save to your lab3/temp directory. I'm having trouble getting the grep to do anything worth while I've been trying to do: cp... (6 Replies)
Discussion started by: Critical jeff
6 Replies

4. Shell Programming and Scripting

can anyone help with shell script command about searching word with grep command?

i want to search in the current directory all the files that contain one word for example "hello" i want to achieve it with the grep command but not with the grep * (2 Replies)
Discussion started by: aintour
2 Replies

5. UNIX for Advanced & Expert Users

Grep Command

Hi, I have encountered a problem with grep command. The max characters that grep can supported is 2048 as defined in LINE_MAX in hp-ux. I try setting $TK_GREP_LINE_MAX but this is not workable in HP-UX, anyone has experienced with setting the max characters supported by grep command. Well,... (5 Replies)
Discussion started by: dwgi32
5 Replies

6. UNIX for Advanced & Expert Users

how to exclude the GREP command from GREP

I am doing "ps -f" to see my process. but I get lines that one of it represents the ps command itself. I want to grep it out using -v flag, but than I get another process that belongs to the GREP itself : I would like to exclude # ps -f UID PID PPID C STIME TTY TIME CMD... (2 Replies)
Discussion started by: yamsin789
2 Replies

7. Shell Programming and Scripting

Help need in Grep Command

Hi I am assaging a variable like this current_dir ='ps -o user|grep -v'USER'|uniq' #this would print the user id " v_name=`date +%m%d%y` outputfile =$v_name$current_dir.txt this gives the output file with timeanddate .txt but not the userid lets assume i have the userrid called... (4 Replies)
Discussion started by: ranga27
4 Replies

8. UNIX for Dummies Questions & Answers

grep command help

Hello, im trying to grep the first 3 lines(starting with ERROR) from an output report and put it in a separate file... any help would be appreciated. Below is the message contained in the report ERROR >Invalid basic data (CMOFCT-5070) Cusip: 05950XAL0 CMO#508039 Tra# 11 rec# 175 Firts Int... (15 Replies)
Discussion started by: geekeezoid
15 Replies

9. UNIX for Dummies Questions & Answers

grep command

Hi, I need to grep two variables at the same time in shell programming. Like today=Dec_16, and $1=5, how can I grep like this: "$today_$1"? Thanks in advance! (5 Replies)
Discussion started by: whatisthis
5 Replies

10. Shell Programming and Scripting

grep command

Hi I have read your article on grep it is very useful. I have a problem using grep , can you please help me to sort out. I am listing the contents of a file below : ##########1003134 05/04/1970F48371008 0736778 6123785090 0E10/13/1997 04/22/1998XSSUB 77 ... (8 Replies)
Discussion started by: Vittal Raj
8 Replies

Featured Tech Videos