0
votes
1answer
51 views

Invalidating email addresses from sql dump before import

Synopsis I would like to import production data into the development environment so testing can be done in an almost accurate way. Of course I need to invalidate e-mail addresses as I don't want ...
1
vote
2answers
156 views

Deleting inserted content in multiple files on linux server

I often have problem with sites that get hacked. Usualy they end up with inserted script in different files. Is there a way, on linux, to search for this content and automaticaly delte it ? Usualy ...
0
votes
2answers
348 views

GREP find and use SED to replace string on all files

One of our old hosted Joomla sites suffered a JavaScript injection, and im going through cleaning it up. The following code was inserted into every .php or .js file: <? #0c0896# echo " <script ...
1
vote
2answers
48 views

I want to filter out two lines from the output of a program [closed]

I have a command that outputs a bunch of data, but I only want two lines. Grep doesn't work because the lines I want are not next to one another. I can't seem to figure out sed... Help please. :) ...
0
votes
2answers
184 views

Regex matching specific details if first match exists, multiline

I'm struggling to get the correct regex to match specifically 'Contact' and 'User-Agent' only if the 'Contact' address matches 10.0.x.x in ~70GB of SIP messages. The SIP message will always contain a ...
0
votes
2answers
332 views

remove non-printing characters

I have a tab delimited text file. When I open the file with vi editor, I can see ^M character (in blue color). This is not part of my data. It got there because the original SQL data had carriage ...
3
votes
2answers
202 views

Extracting a line section of mysql backup using sed

I occasionally need to extract a single record from a mysqlbackup To do this, I first extract the single table I want from the backup... sed -n -e '/CREATE TABLE.*usertext/,/CREATE TABLE/p' ...
2
votes
2answers
143 views

Gathering IP's from a complicated log

I have a question regarding the use of some more advanced grep, awk, sed. I have a log file, for a proprietary MTA, that contains IP's in a string, delimited by [redacted]^~x.x.x.x^[redacted]. So far ...
0
votes
2answers
261 views

Find text, then insert linebreak and some php code across multiple files

I have a certain php code comment that appears in about 75 files across several users. This command succsessfully locates it. (I didn't bother looking for the double slashes because I wasn't sure ...
0
votes
2answers
91 views

Display specific word in file. To be used as varible, grep for email in log

I'm looking to display just the email address in the /var/log/secure file. The email goes into a variable, so just grepping for lines won't work. I know how to string together sed commands, but is ...
4
votes
3answers
2k views

grep or sed to find a integer value above a given amount?

This is in reference to another question: How do I use robocopy to list all files over a certain size recursively? I would like to parse output of a command (or cat a log file) and find a string ...
1
vote
1answer
247 views

Using Find, Grep, Awk, or Sed To Rename Server After Cloning

My client tells me they have cloned a VM in VMWare of an Ubuntu Linux server. Now it's my job to get into all the files and find out what still has the old server name of "bishop" and change it to ...
1
vote
3answers
155 views

alias to replace a text in file

here is a practical situation.I facing some of my files where there is a common string in these files.I usually will open vi and do some thing like :%s/text/replacement/g and I have to do it in ...
23
votes
8answers
41k views

how to find out mac addresses of all machines on network

Is there some easy way to find out mac address of all machines on my network rather than doing an SSH into each and ifconfig | grep HWaddr if there are 300 machines on network I really need some easy ...
1
vote
1answer
373 views

sed can't find a file that obviously exists

I run the following command which comments out all lines that contain the text "dlclose" grep -lIR "dlclose" . | grep -v ".svn" | xargs sed -i "s/.*dlclose.*/\/\/&/g" However, sed claims that ...
1
vote
1answer
317 views

Comment all lines matching some pattern

I need to comment out all lines containing "dlclose" for each file in the current directory and any sub-directories (recursively). This is my best guess so far given what I was able to find out from ...
2
votes
2answers
947 views

How can I remove malware code in multiple files with sed?

I've this malware code in so many .html and .php files on the server. I need to remove them using sed -i expression search all files under directory /home/ find infected files remove the code by ...
4
votes
6answers
2k views

How to remove a tagged block of text in a file?

How can I remove all instances of tagged blocks of text in a file with sed, grep, or another program? If I have a file which contains: random text // START TEXT internal text // ...
2
votes
3answers
394 views

How to grab a word from a file using sed or grep

I am trying to pull a piece of text from a file to use as input for the next command. The word always starts with "JID_" and then some random numbers/characters after that. For example : ...
3
votes
2answers
2k views

How can I use grep to find the most frequently recurring errors in my log file?

I've got a PHP application that is generating large amounts of warnings and notices in the log file.. I'm fixing these one at a time. I would like to be able to fix the most frequently occurring ...
1
vote
3answers
3k views

SED Find & Replace w\ Regular Expressions

Alright, So i'm confused & out of ideas. I'm trying to replace all the old IP addresses with a new one. find -type f | grep \.php$ | xargs sed -r -i ...