Skip to main content

Questions tagged [grep]

For questions pertaining to grep, a command-line tool for searching text patterns in files. Use this tag for questions about grep itself or questions about issues arising from using the grep command-line tool.

3 votes
3 answers
871 views

The following script is supposed to check $1 and see if it is a specific value. It only works when one Bash [[... =~ ...]] regex check is passed in an if statement. The error is: When more than one ...
EmberNeurosis's user avatar
8 votes
1 answer
1k views

Consider this scenario: $ x='yyy ' $ printf %s "$x" | od -tc 0000000 y y y \n 0000004 $ printf %s "xxx" | od -c 0000000 x x x 0000003 $ printf %s "xxx" | ...
pmor's user avatar
  • 757
1 vote
2 answers
129 views

I have a folder with many subfolders full of various Quarto(reg) files & in those files there are links that are located in varying positions in the file lines. UPDATE ON 3 November 2025 in ...
iembry's user avatar
  • 205
7 votes
9 answers
699 views

I've got a text file containing e.g. Success Something Anything Success Somebody Anybody Someone Success (line 8 is deliberately an empty line) and I would like to export every line between the nth ...
Chestal's user avatar
  • 73
2 votes
4 answers
838 views

I have built a Visual Studio solution, containing 92 projects. While building them, I get the following line for every one of them: 10>------ Rebuild All started: Project: HostLinkSw, Configuration:...
Dominique's user avatar
  • 183
0 votes
3 answers
160 views

I'm working with a Linux application. There is a command that I run to display a set of parameters. I would like to run the command and then grep through the results of the command and build a ...
From The City's user avatar
10 votes
5 answers
605 views

With grep I can filter lines. But if the lines are pretty long it gets messy. How can I only get "some chars around" my search-string? f.txt this is a red cat in the room this is a blue ...
chris01's user avatar
  • 1,039
3 votes
2 answers
119 views

I have a longer log file, and I wanted to extract the lines that match a specific word using grep. However after a few thousand lines with matches, grep output Binary file ... matches and that was ...
U. Windl's user avatar
  • 1,777
-1 votes
1 answer
69 views

I'm trying to search a directory of files for occurences of the literal string -d /data/. When I try using grep, I get an error due to the fact that -d is a grep flag: $ grep -F "-d /data" ...
Borea Deitz's user avatar
-2 votes
1 answer
143 views

I have a dir containing logstash config files these files have filter blocks, and sometimes nested child blocks need to match whole filter block filter { any text till final matching closing brace for ...
Sollosa's user avatar
  • 2,009
4 votes
3 answers
525 views

I setup a directory structure as follows: mkdir -p /tmp/test/build/lib/aaa/ cd /tmp/test mkdir rar echo "Hello" > foo.py echo "Hello" > bar.py echo "Hello" > ...
90ueiomtn's user avatar
8 votes
1 answer
601 views

I'm not talking about -o option. Posix says: The search for a matching sequence starts at the beginning of a string and stops when the first sequence matching the expression is found, where "...
Mark's user avatar
  • 99
3 votes
1 answer
378 views

I noticed a difference in behavior between an older pcre2grep version (10.22) and a more recent one (10.42), and I am wondering how I can get the old behavior back. Take the following file: aaa bbb ...
ChennyStar's user avatar
  • 2,019
0 votes
1 answer
821 views

I met an interesting issue while working with this code from Stack Overflow: tripleee's answer on "How to check if a file contains only zeros in a Linux shell?" Why does the same bash code ...
Андрей Тернити's user avatar
1 vote
2 answers
129 views

I'm new to Bash and I've been self-taught. I think I'm learning well, but I do have staggering gaps in my base knowledge. So sorry if this is woefully simple bbuuuttt... Essentially, I need to sift ...
TC575's user avatar
  • 13

15 30 50 per page
1
2 3 4 5
341