no its not a tag. uhmm, never mind the XML file. i just want to know
how to read a line in a file and process that line.

ex:

****file starts****
model01,,,serial12
model02,,,serial35
model04,,,serial98
model90,,,serial71
...
***file ends***

these are the contents of the file. each file in /home/cj/test/ is in
this format. each file has 1000 lines.

what i have in mind is this:

-----------------------------
newfile.writeln("header");

for each file in /home/cj/test/ {
   line = file.readLine();
   model = line.substring(0, line.indexOf(","));
   serial = line.substring(line.lastIndexOf(","));
   newfile.writeln("<data model=\"" + model + "\" serial=\"" + serial
+ "\" >");
}

newfile.writeln("footer");

------------------------------

:) i hope you understand my algorithm.. i want to do this in bash script.

thanks..
On 6/24/06, Ariz Jacinto <[EMAIL PROTECTED]> wrote:
hi,

what do you mean by <model>? was it a tag or an argument?

if it is a tag (w/o end tags), you may process it with a tool called
"normalize" (you may then validate it against a dtd,) then create
an xslt filter to tranform it to your desired xml output. then validate
it again. *whew.


if not, you may use a bash script similar to this:

exec < /path/to/file
while read line
do

    #process the line here

done





On 6/23/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:


how to do this in bash. please dont use perl.



_________________________________________________
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




--
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

Reply via email to