1
vote
2answers
34 views

How to write regular expression in UE to implement this requirement?

Now I have a large C++ project which is made up of about 1400k lines of code. Now I have a requirement: Add one line of code to each class which is derived from CDialog, CWnd or CListCtrl. It's ...
-1
votes
1answer
38 views

How to strip unix timestamps from a string PHP [on hold]

Lets say I have the following string: $string = 'Th1s 1s my 5tr1ng with a timestamp 1357002120 and another timestamp here 1357002120.'; What I want is to return a string, without the two ...
1
vote
3answers
50 views

How can I replace everything before the <html> tag with a Perl command?

A folder on a webserver I manage was recently infected, and a malicious script was placed before the opening <html> tag on a whole mess of files. I'm trying to execute a perl string replace ...
0
votes
1answer
16 views

pcregrep for finding all files with extra space before php opening tag

I have a working command line code using pcregrep for finding all PHP with space after closing tag: pcregrep -rMl '\?>[\s\n]+\z' * I get that here: Find extra space / new line after a closing ...
0
votes
3answers
44 views

Find and trim part of what is found using regular expression

I'm a newbie in writing regular expressions I have a file name like this TST0101201304-123.txt and my target is to get the numbers between '-' and '.txt' So I wrote this formula -([0-9]*)\.txt this ...
0
votes
1answer
19 views

unix move command regex

I have a bunch of files in the format blahblah1.java.bak, blahblah2.java.bak, etc. And I want to change all the files ending with .bak to just .java. Is it possible to do this using the mv command? ...
1
vote
1answer
38 views

Replace dates in a file with timestamp using awk and mktime

I have a large CSV file with dates stored as YYYY-MM-DD. I need to convert these to timestamps. For the sake of conversion, I assume that the time was noon on all dates. I'm trying to use a gawk ...
1
vote
1answer
41 views

Produce a custom nicer ls-l output using awk

I am trying to write a awk script to produce a custom output from ls -l something like this: File xxx.txt has size of 100 blocks, was last modified on July 3 2013, is owned by Kohn. The user has ...
1
vote
3answers
1k views

using backreferences regex in sed

I would like to remove multiple spaces in a file with a single character. Example cat kill rat dog kill cat I used the following regex, which seemed to matched in ...
2
votes
3answers
43 views

Append a string to another with Regex tools

For the life of me, I cannot find out how to do this very simple procedure. I want to: read a file, which consists only of number on each line append characters before and after the number in the ...
16
votes
8answers
13k views

how to use sed, awk, or gawk to print only what is matched?

I see lots of examples and man pages on how to do things like search-and-replace using sed, awk, or gawk. But in my case, I have a regular expression that I want to run against a text file to extract ...
1
vote
2answers
55 views

Replace /**/ in Unix with an empty space

I wanted to replace /**/ across all files in a folder. I tried: perl -pi -w -e 's/\/**\///g;' *.java But got an error: Nested quantifiers in regex; marked by <-- HERE in m//** <-- HERE // at ...
1
vote
2answers
63 views

Regular expression to extract everything between braces in unix

I am trying to extract everything between braces from a text file and write the output to another text file. I was able to construct a regular expression to match everything between {} and it works ...
1
vote
4answers
261 views

Grep files with uncommented “console.log” string

I need to return all files in a directory which contain the string console.log uncommented. So I think I should search for any line which does not have the string // between the newline and the ...
1
vote
5answers
43 views

replacing one word by another in an entire directory - unix

I'm refactoring some code, and I decided to replace one name by another, let's say foo by bar. They appear in multiple .cc and .h files, so I would like to change from: Foo key(); to Bar key(); ...

1 2 3 4 5 22
15 30 50 per page