0
votes
0answers
60 views

Linux flow control exit or break on condition

I have a query about the following flow control. I need help to run a script that has these three conditions: Conditions: Successful: Proceed to read message. Fails: Exit to cat or just exit ...
0
votes
3answers
199 views

Write pipe result to variable

I need to be able to write whether the test for a grep is either TRUE or FALSE to a variable so I can use it later For the following, if I run defaults read com.apple.Finder | grep ...
3
votes
1answer
3k views

How can I avoid the “grep: Argument list too long” error?

I'm using Mac 10.7.5 and on a bash shell. I'm trying to find instances of a string in a group of files but keep getting this error Daves-MacBook-Pro:folder davea$ find . -name "*" | xargs grep ...
0
votes
1answer
239 views

The outputs of ps and top do not match

I have a situation where I have a process, say script.pl (here it is), which seems to stick around in the output to ps auxw | grep script.pl, sometimes when load is heavy it sticks around for several ...
2
votes
1answer
92 views

using grep -E with AND conditions (ex: (?=/fo)^(?=/mo))

I have little problem figuring out how to get a list of files that has: string "/fo" in it But does not have string "/mo" I'm trying to figure out that in folder with lot of text files... My ...
1
vote
1answer
390 views

Simulate pgrep using plain grep

How can I do pgrep -U someUserName using just ps and grep? I.e. not count on pgrep being set in a system?
1
vote
1answer
30 views

Looking for a command that will return the proc, func, etc that uses another proc, func, etc

Grep-ing for a function name to see where it's being used returns a list of rows and row numbers. Is there a smart way of using grep and awk to get the name of the calling procedure instead? Thanks
0
votes
2answers
2k views

grep command in bash scripting

grepstr() { grep "$1 $2" $TMP/"ORACLE_SID"_dbmode.txt > /dev/null 2>$1 } What is the meaning of the above command? What are $1 and $2? Why it is necessary? Is there any alternatives for ...