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

learn more… | top users | synonyms (1)

1
vote
4answers
130 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... ...
0
votes
3answers
110 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
424 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
37 views

How to make a script to move files with find and regex

Im trying to make a find regex script so i automaticly can copy files to specific directory. find . -regex "*test.*s01e([0-9][0-9]).*" -exec cp {} /storage/tv/test/s01/ \; Made this script, dont ...
0
votes
1answer
29 views

Sed with angle brackets

This works sed 's/[[:space:]]*<default>false/XXX/' Why does prepending a > make it fail sed 's/>[[:space:]]*<default>false/XXX/' escaping the > does not help either. In ...
0
votes
1answer
189 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
68 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
39 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 ...
5
votes
0answers
61 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
15 views

What is SELinux's regex type?

I'm trying to locate all files on my system matching an SELinux file context (fcontext). These contexts are specified using some regex, and I'd like to use find -regex ... to the same effect. However, ...
1
vote
0answers
25 views

What types of regex DO support (e.g.) negative lookbehind?

Bash on GNU: I am using a collection of find commands, most of which employ -regex to do their matching. Each time I try a different feature in my regex I have to cycle through the values for ...
1
vote
0answers
27 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
51 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
29 views

SED and regex expressions… addr1 and addr2

How can I use sed to match 'addr1' and reuse it again in 'addr2' field? #Ex.: echo "12a34" | sed 's/a/#bcd/g' # 12abcd34 #\# = match addr1
0
votes
0answers
29 views

egrep for specified strings and newline

I receive a prespecified list of strings. In a number of textfiles (example below), I want to search for strings, that do not start with one of the strings in the list. From time to time, a blank link ...
0
votes
0answers
16 views

Oracle / sql : calculation one or more value within the same field

I want select statement to sum the amount of value 352+652+20+356 that come in the same filed without need PL/SQL . [{Name:"account:account_1"&Value:352&New:256&CreditLimit:0} ...
0
votes
0answers
66 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
19 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
74 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 ...
-1
votes
0answers
24 views

Delete string from all the files in the folder

I'm seeking for way to delete string from all files in the folder by the regular expression pattern. Need to delete not the whole string but just pattern. Need to delete the strings which looks like: ...