Search Results

Search: Posts Made By: netguy
12,088
Posted By netguy
Again, thanks for the help. Here's the...
Again, thanks for the help.

Here's the correct form:
search_arg=`echo "$*" | tr -s ' ' | sed 's/\([()]\)/\\\\\1/g;s/\(\.[0-9]\{1\}\)/\\\\\1/g'`
12,088
Posted By netguy
I've run into a glitch... While testing my...
I've run into a glitch...

While testing my script, I found that many numbers are not getting 'backslashed'! Here's the line in the script that does the backslashing for .0 through .255:
...
12,088
Posted By netguy
I'm all for more efficiency, thanks Perderabo!
I'm all for more efficiency, thanks Perderabo!
12,088
Posted By netguy
Thanks, Ygor. I do need the functionality that...
Thanks, Ygor. I do need the functionality that egrep has, such as '|' (search either) and '.*' (any number of characters/spaces), neither of which fgrep provides. But I also need to 'turn off' some...
12,088
Posted By netguy
Perfect! Thanks very much! The dot was my...
Perfect! Thanks very much!

The dot was my addition...I also want a slash in front of periods, so that they don't act as single-character wildcards.

Here's the final product:...
12,088
Posted By netguy
For some reason that I can't determine, this...
For some reason that I can't determine, this works only from a command line, not from within the script. When run from a script, my search string (which I'm echoing so I can see the conversion)...
12,088
Posted By netguy
My goal is to insert the backslashes within the...
My goal is to insert the backslashes within the user's search string. If I understand your suggestion, the backslashes would surround the entire search string.

Notice that when I converted...
12,088
Posted By netguy
Adding a backslash to users' input
Hi,
I need to convert user-input from '(this)' to '\(this\)' before passing it to egrep. I've tried using TR, SED and NAWK to add the backslash, but the most I ever get is a backslash without a '('...
25,273
Posted By netguy
Perderabo, The example you gave removes all...
Perderabo,
The example you gave removes all spaces from the input line, while I need to remove only redundant spaces. But you did give me a good push in the right direction. Here's what I came up...
25,273
Posted By netguy
Driver, Thanks for the response. I should've...
Driver,
Thanks for the response. I should've mentioned that I'm using a circumvention for this problem, which happens to be very similar to what you've shown. But the problem I have with this...
25,273
Posted By netguy
Losing filename in grep output
I have the following line in a script that searches files in several directories and shows the search results on the screen.

ls "$path" | xargs cat | tr -s " " | fgrep -i "$search_arg"

But,...
Showing results 1 to 11 of 11

 
All times are GMT -4. The time now is 01:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy