#!/bin/bash
echo "<?xml ?>"
echo "<hello>"
cat path/to/file | while read THELINE
do
MYMODEL=$(echo $THELINE | cut -d, -f1)
MYSERIAL=$(echo $THELINE | cut -d, -f5)
echo "\<data model\=\"\<$MYMODEL\>\" serial\=\"\<$MYSERIAL\>\"\>"
done
echo "</hello>"
Make this executable.
chmod +x myscript
Now run the script.
./myscript > myxmlfile
On 6/24/06,
jhuniepi <[EMAIL PROTECTED]> wrote:
hello to all,
i have a list of text files in /home/cj/test/
the files are in the format <model>,,,<serial> of 1000 lines each.
these are text files. i wil read these one by one, line by line, and
process each line. so that i can out put to xml file in the format
below:
<?xml ?>
<hello>
<data model="<model>" serial="<serial>">
<data model="<model>" serial="<serial>">
<data model="<model>" serial="<serial>">
<data model="<model>" serial="<serial>">
</hello>
how to do this in bash. please dont use perl.
TIA
--
cj pangilinan
linux user, java programmer
_________________________________________________
Philippine Linux Users' Group (PLUG) Mailing List
[email protected] (#PLUG @ irc.free.net.ph)
Read the Guidelines: http://linux.org.ph/lists
Searchable Archives: http://archives.free.net.ph
--
Regards,
Martin Acupanda
_________________________________________________ Philippine Linux Users' Group (PLUG) Mailing List [email protected] (#PLUG @ irc.free.net.ph) Read the Guidelines: http://linux.org.ph/lists Searchable Archives: http://archives.free.net.ph

