Results 1 to 3 of 3
I'm trying to write a script which greps a file and sends each line it finds to a function. The following works fine:
Code:
grep REAL_TIME $file
But trying to ...
- 08-29-2007 #1
Bash - grep to function
I'm trying to write a script which greps a file and sends each line it finds to a function. The following works fine:
But trying to output the results to a function (my_function) using any of the following doesn't work.Code:grep REAL_TIME $file
Any ideas?Code:grep REAL_TIME $file >> my_function grep REAL_TIME $file &> my_function grep REAL_TIME $file | my_function
- 08-29-2007 #2Linux User
- Join Date
- Jun 2007
- Posts
- 318
How about this:
Code:grep REAL_TIME $file > tmp.tmp while read lne do my_function "$lne" done < tmp.tmp rm -f tmp.tmp
- 08-29-2007 #3


Reply With Quote