Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
-1 votes
0 answers
27 views

Bash Regex Start Anchor w/Character Classes Not Working [closed]

GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu) Copyright (C) 2019 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html $> var=39Q08a ...
Adam D.'s user avatar
  • 189
3 votes
1 answer
69 views

Making sense of the regex in grep command [closed]

When executing the following command in a bash shell: grep '^\(.\)*\1$' exp.txt I expect it to match any line that: begins and ends with the same latter. but in reality it matches the following ...
Balawi28's user avatar
  • 179
2 votes
2 answers
79 views

Regex using Bash metacharacters in double bracket `[[…]]` command using `=~` operator

The Bash reference manual, in sec. 3.2.5.2 Conditional Constructs, says It is sometimes difficult to specify a regular expression properly without using quotes, or to keep track of the quoting used ...
the_eraser's user avatar
0 votes
0 answers
31 views

Delete the first line match for a domain in a list of domains [duplicate]

So if I have a list of domains in a text file: fake.domain/file google.com/drive/folders stackoverflow/questions google.com/drive/files I'd want to be able to submit a string "google.com/...
ch33zy's user avatar
  • 1
1 vote
2 answers
84 views

Word Boundary in awk

I am trying to extract the lines that contains the word "at" and wrote this awk ' BEGIN { IGNORECASE = 1 } /(failed|caused by|errorcode|error code)/ { ...
Arav Stark's user avatar
2 votes
3 answers
114 views

How to match a group exactly zero times

I am trying to match lines that do not contain a sequence of characters using sed. According to the sed documentation (https://www.gnu.org/software/sed/manual/sed.html), you use () in sed when using ...
T Lytle's user avatar
  • 199
-1 votes
0 answers
21 views

Extended Regular Expression for email id in bash [duplicate]

While learning about BRE and ERE, I came across this example grep -E "[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}" emails.txt emails.txt [email protected] [email protected]....
Arav Stark's user avatar
3 votes
1 answer
173 views

How to retrieve text from the current line at specified cursor position before and after up to specified boundary characters?

Examples of boundary characters can be: "", '', (), space, ^$ (start and end of the line if any other boundary characters are not specified explicitly). Boundary characters should be easily ...
Anton Samokat's user avatar
2 votes
3 answers
139 views

Spelling Bee game regex

In the NYTimes Spelling Bee game, you have to make words (4+ letters long) using a set of 7 letters, one of which must be used in the word. This is fairly trivial to make a regex for: grep '^[bluntam]\...
qwr's user avatar
  • 10.4k
1 vote
3 answers
83 views

Regex that replace number lower than 100 by a string in sed script

I'm testing regular expressions in .sed script to replace a number < 100. I have to change numbers lower than 100 only in the fifth field of the CSV. The CSV is separated by commas. Example CSV: ...
Christian Cid's user avatar
0 votes
0 answers
46 views

Confused about why the regex pattern does not works [duplicate]

I'm using npm ls -a which gives the following ouput: └─┬ [email protected] ├── [email protected] └── [email protected] I'm trying to extract all the dependencies and store it in a file with the following ...
UTKARSH TYAGI's user avatar
0 votes
1 answer
36 views

In Bash, Multiple Substring before Specific Char and Continue with

I am trying to write a regex that can satisfy the following condition. first, string will be start with multiple substrings --> ^(aa|bb|cc) second, then multiple substring it has to be continue ...
Ichigo Kurosaki's user avatar
3 votes
2 answers
59 views

Git+Bash / GitBash: Add files matching both first-letter-uppercase or all-lowercase filenames of certain pattern along with respective plurals

I have some Laravel/Livewire files matching filename patterns like seen in below: app/Livewire/String1Table.php app/Livewire/String1s.php app/Livewire/EditString1.php app/Models/String2Table.php app/...
Vicky Dev's user avatar
  • 2,111
0 votes
0 answers
43 views

How to check for real numbers in bash script programming [duplicate]

I am learning Bash script and I need to write a conditional statement which make sure that my input string is a real number. if [ is not a real number ]; then echo "not a real number" I have ...
Blueminaya's user avatar
0 votes
3 answers
73 views

How to use a variable command in a sed expression [duplicate]

Testing for a simple script but I can't get this variable to cooperate with me. I've tried so many things, single quotes and doubles. New=$(df -h) sed -ie "200s|^.*$|"${NEW}"|g" &...
campbell106's user avatar

15 30 50 per page
1
2 3 4 5
378