Replacing dates]] with (dates)]]


 
Thread Tools Search this Thread
Homework and Emergencies Emergency UNIX and Linux Support Replacing dates]] with (dates)]]
# 1  
Old 01-14-2011
Replacing dates]] with (dates)]]

Hi guys,

For my wiki site I need to fix 1400 pages that use the wrong date format, most pages (not all) use eg. 1988]] I need to change that to (1988)]]

The date range goes back to 1400 so I guess I need to do the following

ssh into my server,
dump mysql database
vi .sql dump
search and replace string
restore new .sql
voila

My request here is, can someone place write the search and replace string for this
# 2  
Old 01-15-2011
I am sure that you can create an SQL statement to do what you want but if you want to do it the way you describe, you can use sed to find and replace the errant string
Code:
sed 's/\([0-9]\{4\}\)]]/(\1)]]/g'

This User Gave Thanks to fpmurphy For This Post:
# 3  
Old 01-15-2011
Difficult search and replace

Hi, for my wiki I need 1 more complicated way to solve a problem.

I have 1400 pages of court cases that are linked throughout the site. The problem is that the title of the pages are

name v name (1988)
and the links should therefor be [[name v name (1988)]]

But, something went wrong and loads of links look like this

[[name vname (1988)]]

So I need a search and replace to do change it back to normal. The issue I can see is that if we simply replace all " v[a-z]" " v [a-z]" that it will also change "victor" into " v ictor"

So can someone please come up with a search and replace solution for this??

---------- Post updated 15-01-11 at 12:28 AM ---------- Previous update was 14-01-11 at 10:41 PM ----------

so I guess something like (sorry I cannot write the expressions)

if " v victor" dont do anything if " victor" change to " v ictor"
# 4  
Old 01-15-2011
Thank you so much!
Would you know how to do the mysql statement??

---------- Post updated at 12:55 AM ---------- Previous update was at 12:05 AM ----------

hi just tried it but it seems it did not have the desired effect,
here is a sample

Code:
Statutes remain law until they are repealed by Parliament. Sometimes this creates absurdities like [[Ashford vthornton 1818]] (right to trial by combat), and [[Prince ernest of hanover vattorney general 1957]], and Parliament normally moves to repeal such legislation rather quickly.
* The principle of ejusdem generis applies if the passage can be so read; that is, where a statute provides a list like `X, Y, and similar Zs', then it will only apply to an item not on the list if it really is of the class Z. For example, `cats, dogs, and other pets' probably excludes lions (as not being pets), but it is not clear whether `cats, dogs, and other animals' would include lions (see the specific entry for [[Ejusdem generis]] for more details).
* The principle of expressio unius est exclusio alterius (``the expression of one is the exclusion of others'') applies. So, for example, ``land and coalmines'' does not include slate mines, because if that meaning were intended that clause would have been ``land and mines''.
* Statutes are assumed not the alter the common law, unless this is stated explicitly. Of course, many statutes are created specifically to alter the common law, and the `mischief rule' relies for its effect on this fact.
* Statutes are assumed not to violate international law; however, if the wording is clear a court cannot disapply a statute even if it is in flagrant violation (e.g., [[R v environment agency ex parte marchiori 2002]]).

# 5  
Old 01-15-2011
Humm, appears to work fine for me as far as the problem description presented by you to this forum.

Please point out by example what you believe should be the correct output

I merged your second post on this topic to this post as they relate to the same issue.

Please take to time to study your problem and provide us with a clear concise description of your problems.

Last edited by fpmurphy; 01-15-2011 at 11:21 AM..
# 6  
Old 01-15-2011
Hi,

Instead of
Code:
[[Ashford vthornton 1818]]

it should be
Code:
[[Ashford vthornton (1818)]]

or combined with my other post it should really be
Code:
[[Ashford v thornton (1818)]]

# 7  
Old 01-15-2011
Quote:
Originally Posted by lawstudent
Hi,

Instead of
Code:
[[Ashford vthornton 1818]]

it should be
Code:
[[Ashford vthornton (1818)]]

Surely it should be:
Code:
[[Ashford v Thornton (1818)]]

You need to be precise if you wish to receive precise help from us.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Display dates between two dates

Hi All, I have 2 dates in mm/dd format. sdate=10/01 (October 01) edate=10/10 (October 10) I need the dates in between these 2 dates like below. 10/01 10/02 10/03 10/04 10/05 10/06 10/07 10/08 (1 Reply)
Discussion started by: jayadanabalan
1 Replies

2. Shell Programming and Scripting

Replacing the Dates in a file

Hello Gurus, I'm beginner in Shell scripting. I got a requirement to write a script. I have a file with below (similar) content If you can observe above content, there are many date values existed (with different dates) in a format: ddMonyyyy I have to write replace all these... (7 Replies)
Discussion started by: raghu.iv85
7 Replies

3. Shell Programming and Scripting

How to get dates between two dates?

HI, to my shell script i pass two parameters date1 and date2 is there any way to get all dates betwen these two dates? if i pass 20130714 and 20130717 i need to get below dates 20130715 20130716 is it possible. thanks (3 Replies)
Discussion started by: ulab
3 Replies

4. UNIX for Advanced & Expert Users

How to get the Missing dates between two dates in the table?

Hi Am Using Unix Ksh ... I have a Table called date select * from date ; Date 01/02/2013 06/02/2013 I need the output as Missing Date 01/02/2013 02/02/2013 03/02/2013 04/02/2013 05/02/2013 06/02/2013 (2 Replies)
Discussion started by: Venkatesh1
2 Replies

5. Shell Programming and Scripting

Generating dates between two dates

HI, i have row like this HHH100037440313438961000201001012012073110220002 N in this i have 2 dates in pos 25-32 and 33-40 , so based upon the se two dates , i need to generated records between these two values so in the above record 20100101 and 20120731 need to genearte rows like this... (4 Replies)
Discussion started by: sathishsr
4 Replies

6. UNIX for Dummies Questions & Answers

How to write the dates between 2 dates into a file

Hi All, I am trying to print the dates that falls between 2 date variables into a file. Here is the example. $BUS_DATE =20120616 $SUB_DATE=20120613 Output to file abc.txt should be : 20120613,20120614,120120615,20120616 Can you pls help me accomplish this in LINUX. Thanks... (5 Replies)
Discussion started by: dsfreddie
5 Replies

7. Programming

SQL: find if a set od dates falls in another set of dates

Don't know if it is important: Debian Linux / MySQL 5.1 I have a table: media_id int(8) group_id int(8) type_id int(8) expiration date start date cust_id int(8) num_runs int(8) preferred_time int(8) edit_date timestamp ON UPDATE CURRENT_TIMESTAMP id... (0 Replies)
Discussion started by: vertical98
0 Replies

8. Programming

Dates in C

Hello, I am working on a program in C and need to read, write and manage Dates (YYY-MM-DD HH:MM). I have made my own version of a structure to store the date data and something else. Do you recommend me to use the time.h library? In such case, is it worthwhile to have an structure containing... (1 Reply)
Discussion started by: Ister
1 Replies

9. Shell Programming and Scripting

Need script to generate all the dates in DDMMYY format between 2 dates

Hello friends, I am looking for a script or method that can display all the dates between any 2 given dates. Input: Date 1 290109 Date 2 010209 Output: 300109 310109 Please help me. Thanks. :):confused: (2 Replies)
Discussion started by: frozensmilz
2 Replies

10. Shell Programming and Scripting

Difference between two dates...

Hi All, Wish you a Happy New year... I have to find the difference between two dates, the result should be the number of days. I have seen the "datecalc" function. Its good, can I have any other alternative. Thanks in Advance Raju (4 Replies)
Discussion started by: rajus19
4 Replies
Login or Register to Ask a Question