What I am wanting to do, is do a while loop sort of thing, for a file, but read more than one line at a time, and tell it to read only between two points at a time.
So file1 contains:
Code:
<dict>
<something>Hello</something
<key>KEY!</key>
</dict>
<dict>
<something>rawr</something>
<key>label</key>
<string>Title</string>
<key>Something else</key>
<string>Hello</string>
<dict>
I have other files that I am going to read like this, as variable
Code:
hello=$(</var/mobile/hello)
rawr=$(</var/mobile/rawr)
the contents of these are <dict>contents of the thing</dict> that match <dict> </dict> of their respective parts in the file.
so I want to use this code (well, something that works, as this does not ):
Code:
while read variable; do
if [[ "$variable" == "$rawr" ]];
then echo "rawr" >> "list";
elif [[ "$variable" == "$hello" ]];
then echo "hello" >> "$list";
else some_handler_code_to_make_new_variable_with_contents_of_dict;
fi
to echo the name into a separate file.
Edit:
or possibly some way to check the lines against each other one at a time? but I would need the end result of the <dict> </dict> still :/
Thanks!
Bookmarks