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.

0 votes
0 answers
10 views

Linux Debian. Some time ago I created Libreoffice Writer document and printed it, but didn't save it. I want to find it electronic copy. How to find a document containing specific strings (in body ...
Lexx Luxx's user avatar
  • 1,471
0 votes
4 answers
108 views

I created a file man df &> man_df Then I want to fetch information about flag -x from the file Expected result is "-x, --exclude-type=TYPE" But command grep "-x" man_df is ...
mascai's user avatar
  • 119
1 vote
6 answers
143 views

I need to isolate a certain substring from a grep command. A typical line inside $FILE would look like this: random text [random number]FIXEDTEXT more random text. I need to retrieve the random ...
weka's user avatar
  • 53
3 votes
3 answers
921 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
3 answers
169 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
745 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
5 answers
893 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
  • 401
0 votes
3 answers
182 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
637 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,049
3 votes
2 answers
161 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
87 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
170 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
549 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
618 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

15 30 50 per page
1
2 3 4 5
342