All Questions
Tagged with regular-expression string
53 questions
-1
votes
1
answer
57
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
5
answers
202
views
add empty line before every line that contains certain characters
I have a lot of markdown files that contains something like this:
* header A
- item 1
- item 2
** sub-header A1
** sub-header A2
* header B
- item 1
- item 2
** sub-header B1
** sub-...
1
vote
1
answer
157
views
How to delete a string in my files?
So I want to match all below then remove those lines of string.
[MTT-5634](https://my.atlassian.net/browse/MTT-5634)
[MCC-123](https://my.atlassian.net/browse/MCC-123)
[MTT-7965]: https://my.atlassian....
0
votes
1
answer
111
views
Parsing text using Python
I have this text;
{bc}having or marked by great {a_link|volume} or bulk {bc}{sx|large
I was trying to get something like this;
having or marked by great volume or bulk
I tried doing this with ...
0
votes
1
answer
218
views
Remove certain words and set word at end of string in files
I have a bunch of files that contain strings similar to:
Get<1>(abc)
Get<2>(xyz)
How can I recursively search for all files with the above pattern and remove everything before the first '(...
0
votes
2
answers
5k
views
Rookie Question: Regex in ZSH Script
I think my problem is very simple. I want to construct a new filename, which has a fixed prefix and a number (two digits), which is part of the old filename.
Example: I have a file 'blableblub23.pdf' ...
0
votes
2
answers
657
views
How to espace sequence of characters in sed?
I am new to regex and running into some frustrations. I am trying to work with strings that express directories and am having the issue reproducible by running:
echo "a" | sed "s/a/home/...
0
votes
1
answer
73
views
PHP: capture a multiline substring
I have a long multiline string (its in a file that I can load into a string), lets take this as example:
<response status="success" code="19">
<result total-count="1" count="1">
<...
16
votes
2
answers
32k
views
Pattern matching in a zsh conditional expression
I am having trouble with pattern matching in zsh's hook function precmd. I have the following:
precmd(){
local x='test'
if [ $x = '*test*' ]; then
echo 'hello'
fi
}
which does not ...
0
votes
2
answers
1k
views
How to delete everything before the occurrence of a regex pattern per line in a bash variable
I've got a bash variable containing several lines of text, which includes IP addresses, and I need to remove 'everything' before the last IP address occurrence in the same line.
This:
43.12.40.53 ...
0
votes
1
answer
825
views
How to capture two regex
In this command, I want to extract strings that are like *.com or *.net, where * is not a dot.
I wrote this:
grep -P -E '^[^.]+\.com$ |^[^.]+\.net$' example.csv
I get this error:
grep: conflicting ...
3
votes
3
answers
12k
views
Modifying a shell variable with regex (bash)
I have a shell variable for example. a="big little man". How do I use regex in bash print out the variable with only the middle word capitalized? (big LITTLE man)
I can do it by separating the ...
1
vote
4
answers
3k
views
RegEx for matching strings in 2nd and 5th columns using grep
I have a file (test.txt) that contains string such as:
name1,6.5.8.12,specs1,version1,['66.55.89.12']
name2,19.13.13.159,specs2,version2,['13.13.173.59'; '14.19.232.42']
name3,141.101.196.40,specs3,...
2
votes
1
answer
15k
views
Grep global find replace [duplicate]
Is there a way to grep for a regular expression on an Ubuntu server and then find and replace it with another string? I am using the following command right now, but it doesn't account for actually ...
3
votes
4
answers
2k
views
Extract addresses separated by semicolon and print each address in a line
I have a file with the following input. The numbers separated by dots represents addresses. Any number in address can be one or more digits as follows:
[112.112.112.112;3.3.3.3;44.44.44.44]
[6.6.6.6;...