Regular expressions are a means of matching a pattern of characters within a string.

learn more… | top users | synonyms (1)

1
vote
4answers
124 views

Regexp on data flow

I want to test if in my data flow, there is something, and do an exit code. I use gammu monitor, which provides a data flow, for example : [root@MYSERVER ~]# gammu monitor Press Ctrl+C to break... ...
2
votes
3answers
465 views

Reverse match in sed, replace opposite of what was found

Say I have this output from my syslog, precalculated src_hash => 20 bytes @ 0x7f811c001e20 A6 2D E5 CD 2A BA F0 42 56 66 19 D4 61 1A E3 A0 .-..*..BVf..a... C7 5E 5F 77 ...
0
votes
3answers
86 views

Finding and replacing text inside awk block

I want to find and replace a value inside awk block. Here is a sample input file to my script P1 10,9:11/18013013582 ,10:1 ,167:0 ,487:5/E.164 11,9:15/310410532169026 ,10:60 ,167:0 ,487:4/IMSI ...
2
votes
2answers
411 views

Regular expressions with ExpectJ

I've been used the ExpectJ Java library to automate some jobs on a Linux server, however now I need to automate a job that sends a different text response for each execution. Here is the output: Last ...
0
votes
2answers
32 views

2 consecutive digits using RegEx?

Is there a way to print words containing 2 consecutive digits divided with whitespace? Regardless of the input, is that possible? If yes, please share your ideas.
0
votes
1answer
183 views

Search for pattern across multiple files and replace a sub-part in all occurences

I am helping a friend with her thesis written in LaTeX and I need a quick solution for a "search and replace". Using a terminal in Linux, how can I find the following pattern: \caption{*\cite{*}} ...
0
votes
1answer
64 views

How can I use gsub with a pattern? And how to tell it which file to awk?

I've read here that I can replace the values of all columns containing a particular text using awk -F'\t' -vOFS='\t' '{ gsub("CC", "C", $1) ; gsub("AA", "A", $1) ; print }' But where do I tell awk ...
-1
votes
1answer
31 views

SMTP log anonymize script

I have a SMTP log with records in the format below: 6,222.3.4.5,3040,100.2.3.4,25,UNKNOWN,0,1,……,9337bc-929a-34c0-29a8-b3a89c834b29 ,protocol,SMTP ,745663746,STATUS-COMPLETE ,VALID ...
4
votes
0answers
43 views

file(1) and magic(5) : prioritizing a result

My question follows that one: file(1) and magic(5) : describing other formats . I want to describe a FASTA sequence ( http://en.wikipedia.org/wiki/FASTA_format) It could be a DNA sequence (with only ...
1
vote
0answers
22 views

grc: Highlight capture groups only?

Recently I came across grc and I find it really simple. However, I would like to highlight some chunks of regex-matched text. For example, svn status properties conflict highlight I hoped to work: ...
1
vote
0answers
30 views

Need .htaccess Rewrite Rule To Remove Trailing <br%20/>

I have links that for some reason have a trailing <br%20/> and I don't know where they are coming from to try and fix them. So I need a general rewrite rule to remove them so the links won't ...
0
votes
0answers
51 views

how to exclude range of numbers using regular expression

I'm trying to write a regular expression in order to cover all numbers starting with 1809 and excluding some ranges: Ranges needed to be excluded Starting with 1809 and followed by: ...
0
votes
0answers
16 views

To visualise look-behind in this Regex

I am using Regexr to visualise my regexes now. I need look-behind but Javascript does not support it, example code here. The project code base seems to be dependent Javascript (NodeJS) in Github. I ...
0
votes
0answers
43 views

Find & replace image URLs in one file from another file

I am trying to replace all the image source URLs in an HTML file from a list of URLs in a text file. File1.html <td class="MetadataRes" width="380px" colspan="2" style="border-top: 1px #336699 ...