Simple unix one-liner to parse an obj file. This file also demonstrates how to evaluate a variable within a sed expression.
Use of cat, grep, let, sed, and a for loop in bash to parse an obj file.
Date Created:Monday February 23rd, 2009 11:29 PM
Date Modified:Monday February 23rd, 2009 11:44 PM
y=0
for x in `cat obj.obj | grep -v f | grep -v vn`;
do let y=$y+1;
echo -n $x " "|sed 's/v/\n'$y' /g' >> parsed;
done;
// you can also add line number like this:
cat -n parsed > newParsed.node
Downloads:
Download: line.sh 205 B
Please login or Click Here to register for downloads
Parse obj files by Dan Lynch
is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
Based on a work at www.3daet.com
Permissions beyond the scope of this license may be available at http://www.3daet.com
