GuestBook
Phoca Guestbook
Title:
Name:
E-mail:
Content:
Image Verification: Captcha Image Reload Image
   
 

Guest ( This e-mail address is being protected from spambots. You need JavaScript enabled to view it ): To see

Friday, 04 September 2009

Guest: salam

marcos   450 629 1135

          514 824  4054

 

Friday, 21 August 2009

admin ( This e-mail address is being protected from spambots. You need JavaScript enabled to view it ): Renaming Batch Files with space

You can create a bash script that will rename all the files and directories under your current directory. Just create a file called rename or whatever with the following code and make it executable.

#!/bin/bash

ls | while read -r FILE do mv -v "$FILE" `echo $FILE | tr ' ' '_' | tr -d '[{}(),\!]' | tr -d "\'" | tr '[A-Z]' '[a-z]' | sed 's/_-_/_/g'` done -------- Or use this if you wanna replace only space with '_' #!/bin/bash ls | while read -r FILE do mv -v "$FILE" `echo $FILE | tr ' ' '_' ` done

#!/bin/bash ls | while read -r FILE do mv -v "$FILE" `echo $FILE | tr ' ' '_' ` done

 

 

 

Thursday, 13 August 2009

Kamal BAKOUR ( This e-mail address is being protected from spambots. You need JavaScript enabled to view it ): Mass Renaming Linux

Mass renaming with linux shell

When you do mv *.aaa *.bbb, it’s not obvious to a newbie that it won’t work.

The solution is a bit more tricky and needs piping (|) and sed.

So, if you wanted to rename all the .php3 to .php, this would be the command:

ls -d *.php3 | sed 's/\(.*\).php3$/mv "&" "\1.php"/' | sh

so what does this do?

  • ls -d *.php3 outputs a list of all the php3 files in the directory. This list is piped to the second command,
  • sed ’s/\(.*\).php3$/mv "&" "\1.php"/’ is not as obvious for newbies. sed is a tool to edit stream. Here the stream is the list of files. the argument passed to sed ’s/\(.*\).html$/mv "&" "\1.php"/’ is what should be edited:
  • s tells sed to replace a string by another,
  • (.*\).php3$ is a regular expression to tell that the string we will want to replace is anyname.php3,
  • mv "&" "\1.php" is the replacement string. the \1 is there to take the name of the file in the first string and put it there. & refers to the portion of the pattern space which matched,
  • | sh takes the output of sed and executes it (sh is the shell interpreter). hence executing the list of mv anyname.php3 anyname.php.
2Anything

In fact this trick could be used for anything. The sole part that will change would be the replacement string in the sed command.

Then if you want to replace all the php3 references in a f

Thursday, 13 August 2009

 

Display Num