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

learn more… | top users | synonyms (1)

1
vote
4answers
119 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
197 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
46 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
400 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
1answer
150 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
61 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 ...
3
votes
0answers
30 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 ...
0
votes
0answers
23 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 ...