Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )



Advanced DNS Management
New ZoneEdit. New Managment.

FREE DNS Is Back

Sign Up Now
> Windows to Linux server conversion, Uppercase to lowercase
Jude
post Jun 23 2009, 07:27 AM
Post #1


Whats this Lie-nix Thing?
*

Group: Members
Posts: 5
Joined: 23-June 09
Member No.: 14,517



I hope this is not a beaten horse, but I cannot seem to find any information about it online...

...recently a friend moved his site from a windows server to a linux one based on the recommendation of his new shopping cart. The problem is that when he put his site together, many years ago, he used capital letters in the names of his directories and filenames. This is now causing tons and tons of broken links. Is ther a program or technique known that can help with this? Is the only option to go through all the lines of code manually changing upcase names to lowercase?

Any assistance is appreciated.

Go to the top of the page
 
+Quote Post
 
Start new topic
Replies (1 - 8)
Jude
post Jun 23 2009, 05:36 PM
Post #2


Whats this Lie-nix Thing?
*

Group: Members
Posts: 5
Joined: 23-June 09
Member No.: 14,517



With already 30 people having looked and not responded to this topic I am beging to feel as if theere is no quick fix.

AM i correct in assuming that people are viewing this page in the hope that there is a link to a quick fix posted being that this is such a nightmare of a problem?
Go to the top of the page
 
+Quote Post
michaelk
post Jun 23 2009, 05:57 PM
Post #3


Its GNU/Linuxhelp.net
*******

Group: Support Specialist
Posts: 1,797
Joined: 23-January 03
Member No.: 360



It is very easy to create a simple bash script using sed for example that will perform a search and replace and you can find lots of help by googlng.
Go to the top of the page
 
+Quote Post
robert83a1
post Jun 24 2009, 04:43 AM
Post #4


Whats this Lie-nix Thing?
*

Group: Members
Posts: 2
Joined: 8-August 03
Member No.: 1,232





See this : http://webxadmin.free.fr/article/shell-ren...to-lowe-135.php

Sincerely
Robert B
Go to the top of the page
 
+Quote Post
Jude
post Jun 24 2009, 07:58 AM
Post #5


Whats this Lie-nix Thing?
*

Group: Members
Posts: 5
Joined: 23-June 09
Member No.: 14,517



QUOTE (robert83a1 @ Jun 24 2009, 04:43 AM) *


Thank you so much for the response. It looks to me like that program changes the file names. What i want to do is change the filenames IN the html code, not the actual file names. Is there anything that can do this?
Go to the top of the page
 
+Quote Post
Jude
post Jun 24 2009, 08:14 AM
Post #6


Whats this Lie-nix Thing?
*

Group: Members
Posts: 5
Joined: 23-June 09
Member No.: 14,517



QUOTE (michaelk @ Jun 23 2009, 05:57 PM) *
It is very easy to create a simple bash script using sed for example that will perform a search and replace and you can find lots of help by googlng.



A bash script? Sorry, I am new to this, is this something i could teach myself to do in a day? I did spend hours googling but foudn nothing so came here for help. Should I google Bash?
Go to the top of the page
 
+Quote Post
michaelk
post Jun 24 2009, 09:33 AM
Post #7


Its GNU/Linuxhelp.net
*******

Group: Support Specialist
Posts: 1,797
Joined: 23-January 03
Member No.: 360



for i in $(ls *.whatever); do sed 's/oldstring/newstring/g' $i > $i-tmp; mv $i $i-backup; mv $i-tmp $i; done

Basically this command will iterate the current directory for every file that matches *.whatever, replaces oldstring with newstring and creates a new file called filename-tmp
The original file filename is saved as filename-backup and the revised filename-tmp is renamed filename. Best to check this on some test files in a seperate directory.

Without knowing the distribution/version I assume your using bash. You can do this multiple times if there are more then one line that requires modification
Using a text editor.

#!/bin/bash
forfor i in $(ls *.whatever); do sed 's/oldstring/newstring/g' $i > $i-tmp; mv $i $i-backup; mv $i-tmp $i; done
for i in $(ls *.whatever); do sed 's/oldstring1/newstring1/g' $i > $i-tmp; mv $i $i-backup; mv $i-tmp $i; done
Go to the top of the page
 
+Quote Post
Jude
post Jun 24 2009, 12:29 PM
Post #8


Whats this Lie-nix Thing?
*

Group: Members
Posts: 5
Joined: 23-June 09
Member No.: 14,517



QUOTE (michaelk @ Jun 24 2009, 09:33 AM) *
for i in $(ls *.whatever); do sed 's/oldstring/newstring/g' $i > $i-tmp; mv $i $i-backup; mv $i-tmp $i; done

Basically this command will iterate the current directory for every file that matches *.whatever, replaces oldstring with newstring and creates a new file called filename-tmp
The original file filename is saved as filename-backup and the revised filename-tmp is renamed filename. Best to check this on some test files in a seperate directory.

Without knowing the distribution/version I assume your using bash. You can do this multiple times if there are more then one line that requires modification
Using a text editor.

#!/bin/bash
forfor i in $(ls *.whatever); do sed 's/oldstring/newstring/g' $i > $i-tmp; mv $i $i-backup; mv $i-tmp $i; done
for i in $(ls *.whatever); do sed 's/oldstring1/newstring1/g' $i > $i-tmp; mv $i $i-backup; mv $i-tmp $i; done



Thank, but I still dont think that this is the fix for my problem. It seems like this is still only changing filenames to lowercase AND NOT THE HTML CODE. The file naems have been changed already, ITS TEH HTML CODE THAT I WANT CHANGED. Can any help?
Go to the top of the page
 
+Quote Post
michaelk
post Jun 24 2009, 04:43 PM
Post #9


Its GNU/Linuxhelp.net
*******

Group: Support Specialist
Posts: 1,797
Joined: 23-January 03
Member No.: 360



It will change the file contents from oldtext to newtext.

http://en.wikipedia.org/wiki/Sed
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 20th October 2017 - 09:56 PM