Basically, its a game server (minecraft) and I have a situation where I am attempting to automate new world generation. Basically, I have a file that gets generated happily which has this snippet in it.
keepSpawnInMemory: 'true' spawnLocation: ==: MVSpawnLocation yaw: 0.0 pitch: 0.0 z: 256.5 y: 62.0 x: -223.5 autoLoad: 'true' bedRespawn: 'true'
This works fine, but I need to extract the z: 256.5, y:62.0 and x: -223.5 respectively and then write a file called file2.txt with the following lines.
world: mine x: -223.5 y: 62.0 z: 256.5 yaw: 0.0 pitch: 0.0 name: mine
I assume I'll be using something like awk to extract the initial numbers, assigning them to variables then writing the file? I have never used awk before, and I am insanely confused. Appreciate any help in this guys. Im using Ubuntu linux, bash scripts. Can I extract text like that and make them into variables using awk and bash?
I did forget to mention that the file 1 has multiple instances of x,y and z. It can be accessed here: http://pastebin.com/TqaLcWzV
Is there a way to start at a certain line? For example, z, y and x will always be on lines 183, 184 and 185 respectively.