New answers tagged grep
3
votes
Accepted
How to search for all text lines that start with a tab character?
I need to find all lines in a text file that start with tab.
You need to start cmd with the /f:on parameter. This changes the file completion character to ctrlf and frees up tab so you can use it on ...
2
votes
How to search for all text lines that start with a tab character?
For those of us who use Powershell, it can be achieve with the cmdlet:
Select-String test.txt -Pattern "^\t.+"
This will show the lines and indicates the line number. If you don't want to ...
0
votes
Vim hiding quickfix column / gutter
you can enable and disable the sign column (aka the gutter), check documentation with :h signcolumn
First check your current value so you can reset it after temporarily disabling. Default value is ...
0
votes
grep output to file does not work - ping www.google.com |grep -v "time=1." >>ping.log
Change it to:
ping www.google.com | grep -v --line-buffered "time=1." >> ping.log
--line-buffered will force buffering to be flushed with each line so that you can output them to the ...
9
votes
Accepted
Maven - ignore ANSI color escaping chars in grep search
There's also --batch-mode (-B) for mvn which makes the output more suitable for e.g. CI or searches likes this as it's more automated.
Or, a generic solution, strip ANSI colors in any command by using ...
6
votes
Maven - ignore ANSI color escaping chars in grep search
Seems mvn has a config of -Dstyle.color=auto to ignore the ANSI color escaping chars so that I don't need to alter the pattern in my script to add .*.
# define an alias including the color settings
$ ...
1
vote
Accepted
Using grep to search for files with a specific extension
Use --include=\*.cs
grep -l -i -r --include=\*.cs "public virtual List<" /mnt/c/mycode/*
8
votes
How to check if a command is running currently?
The common trick to skip the line with the grep itself is to use some kind of a regex:
ps aux | grep '[c]url'
The commmand itself now doesn't contain the string curl itself, so it won't match.
2
votes
How to check if a command is running currently?
One possible way is to add another grep to filter the grep process
instead of
ps aux | grep curl
make it
ps aux | grep curl | grep -v grep
11
votes
How to check if a command is running currently?
You can just use pgrep curl, which returns process ID(s) only if a running process is found. Example:
[ -n "$(pgrep curl)" ] && echo "yes" || echo "no"
pgrep ...
0
votes
gnu grep -r -R -recursive not working on Windows 11
I eventually found an answer to my question. The thing that was needed was a place to start, which I unwisely assumed would be the directory you are in. So, the command would need to look as follows:
...
3
votes
Does Microsoft word have wildcards for return (\r) & new line (\n) like Grep or Regex do?
In Microsoft Word, you can use wildcards to search and replace formatting characters, including return and newline characters. To do this, follow these steps:
Press Ctrl + H to open the Find and ...
Top 50 recent answers are included
Related Tags
grep × 1101linux × 429
bash × 288
command-line × 163
regex × 145
sed × 120
awk × 100
unix × 98
find × 91
macos × 51
search × 48
shell × 47
windows × 35
ubuntu × 32
terminal × 29
xargs × 29
pipe × 28
shell-script × 22
tail × 20
vim × 19
cygwin × 19
ack × 18
bash-scripting × 15
ps × 15
windows-7 × 14