#!/bin/bash
# BASH Script to generate $EXTENSION files like FILE_fr.$EXTENSION,FILE_sp.$EXTENSION from existing FILE_$SEARCHSTRING.$EXTENSION without causing any kind of overwrite.
DIR=/tmp/html
EXTENSION=extension
SEARCHSTRING=en
cd $DIR > /dev/null 2> /dev/null
count=`find *$SEARCHSTRING.$EXTENSION | wc -l`
n=1
echo $count \"*$SEARCHSTRING.$EXTENSION\" files found
while [ $n -le $count ]
  do
      {
       filename=`find *$SEARCHSTRING.$EXTENSION | head -$n | tail -1`
       echo $filename
       language=(fr sp po)
       for (( i = 0 ; i < ${#language[@]} ; i++ ))
          do
            
            value=`ls $filename | awk -F "$SEARCHSTRING.$EXTENSION" {'print $1'}`
            find "$value""${language[$i]}".$EXTENSION > /dev/null 2> /dev/null
            if [ $? != 0 ]
         then
            {
            cp "$value"$SEARCHSTRING.$EXTENSION "$value""${language[$i]}".$EXTENSION
            }
            fi
 done 
        n=$[$n + 1]
       } 
done
cd -  > /dev/null 2> /dev/null 
exit
Saturday, November 3, 2007
Subscribe to:
Post Comments (Atom)
AT&T USA | Internet not working | Fix by custom APN
If the AT&T Mobile internet is not working on your cellphone, it can be fixed easily by adding an APN configuration. You can read this a...
- 
Hi there, You all know how to check TCP port connectivity from a Linux or UNIX machine to a remote machine using telnet as per th exampl...
- 
Before you start Ensure that you have installed wvdial, usbmodeswitch and usbmodeswitch_data # dpkg -l | grep wvdial # dpkg -l | grep ...
- 
Bored of Black screened Task bar filling putty? Issues with porting Saved sessions from machine to machine? Do you like tabbed SSH sessions?...
 
 
No comments:
Post a Comment