awk - replace number of string length from search and replace for a serialized array
Hello,
I really would appreciate some help with a bash script for some string manipulation on an SQL dump:
I'd like to be able to rename "sites/WHATEVER/files" to "sites/SOMETHINGELSE/files" within the sql dump.
This is quite easy with sed:
ok, my problem is that some of these strings are within an serialized array (from php) and some not.
see part of the sql dump:
The ones that are within the serialized arrays have something like s:51: before the actual string. the number refers itself to the length of the following string. When changing the string usually the length changes as well and php doesn't let me unserialize the array properly.
I guess that I'd need to write some lines with awk to count on the new string and to overwrite the number. But I doesn't really have a clue about awk. Is there a friendly person that would help me out?
I have a customer who logged some cc and bank account numbers in their apache logs. I got the cc numbers x'd out with
sed -e 's/args=\{16\}/args=XXXXXXXXXXXXXXXX/g' -e 's/cardnum=\{16\}/cardnum=XXXXXXXXXXXXXXXX/g'but that wasn't too difficult due to the value being 16 digits.
The bank account... (7 Replies)
Hi
I need to be search a file of fixed length records and when I hit a particular record that match a search string, substitute a known position field
In the example file below
FHEAD000000000120090806143011
THEAD0000000002Y0000000012 P00000000000000001234
TTAIL0000000003... (0 Replies)
Need help with either sed or awk to acheive the following
file1
-----
In the amazon forest
The bats eat all the time...
mon tue wed they would eat berries
In the tropical forest
The bats eat all the time...
on wed bats eat nuts
In the rain forest
The bats eat all the time...
on... (2 Replies)
I have a file
DS1
DDS
DS
I want to replace only "DS" to "DSmail.blah.com" in a lot of files. I tried
sed 's/DS/DSmail.blah.com' but it changes all the lines .
thanks in advance (2 Replies)
Hi all.
I have the following command that is successfully searching for any one of the strings on all lines of a file and replacing it with the instructed value.
cat inputFile | awk '{gsub(/aaa|bbb|ccc|ddd/,"1234")}1' > outputFile
This does in fact replace any occurrence of aaa, bbb,... (2 Replies)
Hi,
i want to search and replace array values by using perl
perl -pi -e "s/${d$i]}/${b$j]}" *.xml
i am using while loop for the same. if i excute this,it shows "Substitution replacement not terminated at -e line 1.".
please tell me what's wrong this line (1 Reply)
Hello,
I've a file file_1.txt
ul.ln = 'Kb' AND (il.sum = 'ec7ccc92585adac28d9b1fb5eff0473f' or length('ec7ccc92585adac28d9b1fb5eff0473f') = 7);
il.sum = '20ddc1368d588dd0b0e37c41721e05b1' OR length('20ddc1368d588dd0b0e37c41721e05b1') = 7);
I need to replace the file like below -
ul.ln... (4 Replies)
The requirement is i need to find an array value matching with pattern {5:{ , replace that with 5: and reassign that to same array index and print it.
I write something like below and the issue is sed command is not working. If i replace " with "`" the script gives syntax error.how can i... (8 Replies)
Discussion started by: bhagya123
8 Replies
LEARN ABOUT SUSE
ninpaths
NINPATHS(8) InterNetNews Documentation NINPATHS(8)NAME
ninpaths - Report Usenet Path statistics (new inpaths)
SYNOPSIS
ninpaths -p -d dumpfile
ninpaths -r site -u dumpfile [-u dumpfile ...] -v level
DESCRIPTION
This is an efficient and space-saving inpaths reporting program. It works as follows: you feed it the Path lines via an INN channel feed
or some other similar method, and from time to time the program writes all its internal counters accumulated so far to a dump file.
Another instance of the program picks up all the dump files, adds them up and formats them into the report. The purpose of the final
report is to summarize the frequency of occurrence of sites in the Path headers of articles.
Some central sites accumulate the Path data from many news servers running this program or one like it, and then report statistics on the
most frequently seen news servers in Usenet article Path lines. The sendinpaths shell script can be run once a month to mail the
accumulated statistics to such a site and remove the old dump files.
You can get a working setup by doing the following:
1. Create a directory at pathlog/path (replacing pathlog here and in all steps that follow with the full path to your INN log directory).
2. Set up a channel feed using an entry like:
inpaths!:*:Tc,WP:ninpaths -p -d <pathlog>/path/inpaths.%d
if your version of INN supports WP (2.0 and later all do). Replace <pathlog> with the full path to your INN log directory.
3. Enter into your news user crontab something like:
6 6 * * * ctlinnd flush inpaths!
(the actual time doesn't matter). This will force ninpaths to generate a dump file once a day.
4. Once per month, run the sendinpaths script, which collects the dumps, makes a report, and then deletes the old dumps. (You can
generate a report without mailing it and without deleting it with "sendinpaths -n".)
OPTIONS -d dumpfile
Save dumps in dumpfile. Any %d in dumpfile will be replaced with the current system time when the dump is made. This option should be
used with -p.
-p Read Path lines from standard input.
-r site
Generate a report for site. Generally site should be the value of pathhost from inn.conf.
-u dumpfile
Read data from dumpfile. This option can be repeated to read data from multiple dump files.
-v level
Set the verbosity level of the report. Valid values for level are 0, 1, and 2, with 2 being the default.
NOTES
If your INN doesn't have the WP feed flag (1.5 does not, 1.6 does, 1.7 I don't know, 2.0 and later all do), use the following newsfeeds
entry:
inpaths!:*:Tc,WH:ginpaths
where ginpaths is the following script:
#!/bin/sh
exec egrep '^Path: ' | ninpaths -p -d <pathlog>/path/inpaths.%d
replacing <pathlog> as above.
SEE ALSO newsfeeds(5), sendinpaths(8)
This is a slightly modified version of Olaf Titz's original ninpaths program, which is posted to alt.sources and kept on his WWW archive
under <http://sites.inka.de/~bigred/sw/>.
HISTORY
ninpaths was written by Olaf Titz <olaf@bigred.inka.de>.
The idea and some implementation details for ninpaths come from the original inpaths program, but most of the code has been rewritten for
clarity. This program is in the public domain.
$Id: ninpaths.pod 7851 2008-05-26 19:33:08Z iulius $
INN 2.5.2 2009-05-21 NINPATHS(8)