Jump to content
  • Announcement

    The HyperSpin 2 early access beta is here!

    We’re starting the first public testing phase with Platinum Members to keep the scope manageable while we test the current feature set and begin to add more. In the future, we’ll provide a version for basic members as well.  On behalf of the entire HyperSpin team, we look forward to another exciting adventure with our community.

Find Clones script


Aetron

Recommended Posts

Posted

Hi, 

frind of mine made a little script to tag clones in an xml where the tag is missing. 

I testest it with MSX 2 and it works quit well. 

Beware its for linux and zsh. 

 

#!/bin/zsh

game1="foobar"
game2=""
setclone=0

cat "$1"| while read line; do
  if [[ "$line" != *"cloneof"* ]] && echo "$line"

  if [[ "$line" == *"game name"* ]]; then
    game2="$(echo "$line" | awk -F"\"" '{print $2}')"
    if [[ "$game2" == "$game1"* ]]; then
      setclone=1
    else
      game1="$game2"
    fi
  fi

  if [[ "$line" == *"cloneof"* ]]; then
    if [ $setclone -eq 1 ]; then
      echo "<cloneof>$game1</cloneof>"
      setclone=0
    else
      echo "<cloneof></cloneof>"
    fi
  fi
done

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...