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 DEBIAN
samidare
SAMIDARE(1) User Commands SAMIDARE(1)NAME
samidare - web page update checker
SYNOPSIS
samidare [OPTION]... [URL]...
DESCRIPTION
Samidare checks web page updates. It takes a list of URLs in a configuration file, config.yml, and checks last update time of them. A
HTML file, latest.html, is generated to show the updates.
OPTIONS --help show help message.
-v, --verbose
specify verbose mode.
-n, --no-check
don't check web. output generation only.
-f, --force
force check (avoid timing control mechanism)
-o, --output=filename
specify output html filename.
--output-lirs=filename
specify output lirs filename.
-T, --template=filename
specify template filename.
-t, --timing
show check time of pages.
--dump-config
dump flatten configuration.
--dump-status
dump status. If URLs is specified, the status of specified pages are shown.
--dump-template-data
dump data for expand template. The "data" variable in template file refer this.
--dump-filenames
dumps locally stored filenames of pages specified by URLs.
--dump-filenames2
dumps locally stored recent two filenames of pages specified by URLs.
--remove-entry
remove entry of pages specified by URLs.
--diff-content
show difference of recent two files of specified URLs.
USAGE
samidare is configured by "config.yml" and "t.latest.html" by default.
samidare generates "latest.html" and "sites.lirs.gz"
samidare uses "status.rm" and "tmp" to record status of pages.
"config.yml" is a configuration file in YAML format. See EXAMPLES section for its content.
"t.latest.html" is a template file. In the file, "data" variable can be used. See the document of htree library for template directives.
So you can run samidare as follows.
% cd $HOME
% mkdir samidare
% cd samidare
% vi config.yml
% vi t.latest.html # optional
% samidare
% w3m latest.html # view the result
If you want to publish the result, use symbolic link to latest.html and sites.lirs.gz as follows.
% mkdir public_html
% mkdir public_html/samidare
% cd public_html/samidare
% ln -s ../../samidare/latest.html .
% ln -s ../../samidare/sites.lirs.gz .
EXAMPLES
The configuration file is described in YAML format.
The simplest configuration is list of URLs as follows.
- http://www.example.org/blog/
- http://www.example.net/
FILES
"config.yml" and "t.latest.html" is configuration file.
"latest.html" and "sites.lirs.gz" is output.
"status.rm" and "tmp" is used by samidare internally.
SECURITY
samidare stores pages in tmp directory. If it is published via your web server, XSS (cross site scripting) is possible. So the directory
should not be published.
AUTHOR
Tanaka Akira
SEE ALSO
htree
samidare 0.7 July 2008 SAMIDARE(1)