I'm having a very difficult time with regular expressions embedded in "sed". Regex is not this difficult in BBedit. Hear is what I am try to do.
1. I have multiple lines of data that looks like this:
32.60815684 49.75617397 162.6619038 -16.19942851 11.2 -2.026439909e-016
2. I need to format each line of data to look like these two lines of data:
RENDERER*TREE*$cube1*TRANSFORMATION*POSITION SET 32.60815684 49.75617397 162.6619038<br/>
RENDERER*TREE*$cube1*TRANSFORMATION*ROTATION SET -16.19942851 11.2 -2.026439909e-016<br/>
3. Currently I can only get sed to work when I don't have regular expressions in my command such as this:
#!/bin/sh
sed s
/mike
/name
/g original_file.xml > new_file.xml
4. How do I properly execute finiding tabs. All the command that I am used to in BB edit such as \t or \d or \w don't work properly. Realizing I'm missing something import to get this command to work, how can I get this type of command working:
#!/bin/sh
sed s
/(.+)\t(.+)\t(.+)\t(.+)\t(.+)\t(.+)\r
/RENDERER\*TREE\*\$cube1\*TRANSFORMATION\*POSITION \1 \2 \3<br/>\rRENDERER\*TREE\*\$cube1\*TRANSFORMATION\*ROTATION \4 \5 \6<br/>\r
/g original_file.xml > new_file.xml
5. In examples 3 and 4 I have also included a carrage return for legability, how do I get this to excute so that the uglyness of regex is subdued a bit.
Thanks again any help and guidance anyone can offer.
1. I have multiple lines of data that looks like this:
32.60815684 49.75617397 162.6619038 -16.19942851 11.2 -2.026439909e-016
2. I need to format each line of data to look like these two lines of data:
RENDERER*TREE*$cube1*TRANSFORMATION*POSITION SET 32.60815684 49.75617397 162.6619038<br/>
RENDERER*TREE*$cube1*TRANSFORMATION*ROTATION SET -16.19942851 11.2 -2.026439909e-016<br/>
3. Currently I can only get sed to work when I don't have regular expressions in my command such as this:
#!/bin/sh
sed s
/mike
/name
/g original_file.xml > new_file.xml
4. How do I properly execute finiding tabs. All the command that I am used to in BB edit such as \t or \d or \w don't work properly. Realizing I'm missing something import to get this command to work, how can I get this type of command working:
#!/bin/sh
sed s
/(.+)\t(.+)\t(.+)\t(.+)\t(.+)\t(.+)\r
/RENDERER\*TREE\*\$cube1\*TRANSFORMATION\*POSITION \1 \2 \3<br/>\rRENDERER\*TREE\*\$cube1\*TRANSFORMATION\*ROTATION \4 \5 \6<br/>\r
/g original_file.xml > new_file.xml
5. In examples 3 and 4 I have also included a carrage return for legability, how do I get this to excute so that the uglyness of regex is subdued a bit.
Thanks again any help and guidance anyone can offer.