All Questions
11 questions
-1
votes
1
answer
45
views
I can't grep some inputrc string
bind -p |grep -E "\\e.\":" work
but
bind -p |grep -E "\\e\\C-.\":" don't work
I tried a lot of combination
-1
votes
3
answers
101
views
How to use a variable in a command inside of a bash file
I use this command directly on our redhat linux server 8.8 and it's working correctly and I get the result I want:
grep '01-FEB-2024' /u01/app/server1/listener_scan/trace/listener_scan.log | awk '{ if ...
3
votes
1
answer
2k
views
prevent single quotes in bash script
I have a bash script that's just a shortcut to the grep command. I call it like this:
stx -p /var/www -t 'my text'
This would run this command:
sudo grep -rinI /var/www -e 'my text'
I'm trying to ...
4
votes
3
answers
14k
views
Escape [ in grep
I read strings from stdin and I want to display the users that match the strings. Problem is, if the user inputs the character '[', or a string containing it.
grep -F does not work because the line ...
7
votes
1
answer
1k
views
How to extract the string between two \n in a file
I have a file with pattern
<span class="WebRupee">Rs.</span>\n29\n<br/><font style="font-size:smaller;font-weight:normal">\n3 days\n</font></td>, <td class=...
2
votes
1
answer
254
views
In bash, grep for a line beginning with \, and assign the result using backticks
In bash, I'm trying to grep a file for a line beginning with a \, and return the result using backticks.
For example:
echo \\Hello > myFile
out=`cat myFile | grep '^\\Hello'`
echo $out
returns ...
1
vote
2
answers
961
views
How to put $@ in quotes?
My bash script looks like this:
#!/bin/bash
grep -r --color=always $@ . | nolong
The file is saved in /usr/bin/findstr
Everything's ok when I run this:
findstr hello
But when I run this:
findstr ...
4
votes
4
answers
2k
views
fgrep beginning of line?
I'd like to use fgrep to handle searching literal words with periods and other meta-characters in grep, but I need to ensure the word is at the beginning of the line.
For example, fgrep 'miss.' will ...
8
votes
5
answers
16k
views
bash event not found trying to match and exclude parenthesis in grep
In a very long line I'll summarize with:
(foo),(bar,baz(word,right),(end)
I want to print only:
(bar,baz(word,right
To match the second parenthesis, I exclude the word that follows the third ...
2
votes
3
answers
4k
views
Very strange behavior with grep and IFS
I'm having trouble using grep, the returned results are "n-empty", I mean without the 'n' character...
This is the script sample :
OLDIFS=$IFS
IFS="\\n"
i=$(grep -ril $1 *)
echo $i
IFS=$OLDIFS
I ...
5
votes
2
answers
6k
views
Use of quotes in GNU grep regular expressions
I could see that certain patterns in the GNU Grep can be enclosed within brackets and certain others need not be. For example, matching the beginning of a word works only if it is enclosed within ...