Read xml file till script finds separation and run again for next input and so on


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Read xml file till script finds separation and run again for next input and so on
# 1  
Old 02-19-2016
Read xml file till script finds separation and run again for next input and so on

Hi All,
I have one query, I managed to run script with user inputs through command line or with 1 file.
But I need to read a txt file/xml file in which user can mention multiple sets of answers and script should run for each set till it reach the EOF.
Thanks in advance
for example, the file will looks like:
Code:
1)
name=java-tree
path=/home/tamt/java-tree
value=100
type=solid
######################
2)
name=dotnet-tree
path=/home/tamt/dotnet-tree
value=80
type=solid
######################
3)
name=shell-tree
path=/home/tamt/shell-tree
value=50
type=comp
######################


Last edited by Franklin52; 02-19-2016 at 01:10 PM.. Reason: Please use code tags
# 2  
Old 02-19-2016
Why don't you use a while read ... ; do ... ; done < file loop?
# 3  
Old 02-20-2016
Thanks mate for your reply.
Yes i was using while loop only for reading input from file.
But this case is bit different. I want the script to read all parameters from file till it get ##### and perform the desired operations. Once done script should again read the file but now it should read the data after #### and so on for several sets of inputs- could you please help?
# 4  
Old 02-21-2016
Show us the script you have that works with 1 query.

It seems, as RudiC suggested, that you should be able to wrap your current script inside a while loop to make it process as many queries as happen to appear in a file. If you don't think you can do that, after you have shown us your script, we will help you wrap the appropriate parts in a while loop.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script does not read input file

Hi everyone, I have problems with this script. This script should check for a folder for each server in the list of the list.txt file. The script only checks the first host, and then exits, why? #!/bin/bash file='/etc/list.txt' while read line; do echo $line if ssh root@$line "stat /var >... (2 Replies)
Discussion started by: nashrik
2 Replies

2. Shell Programming and Scripting

Bash script to read a file from particular line till required line and process

Hi All, Am trying to write wrapper shell/bash script on a utility tool for which i need to pass 2 files as arugment to execute utility tool. Wraper script am trying is to do with above metion 2 files. utility tool accepts : a. userinfo file : which contains username b. item file : which... (2 Replies)
Discussion started by: Optimus81
2 Replies

3. Red Hat

How to read an xml file through shell script?

Hey , can we read an xml file and make changes in it through shell script. Thanks (4 Replies)
Discussion started by: ramsavi
4 Replies

4. Shell Programming and Scripting

Shell Script to read XML file

Hi unix Gurus, I am really new to Unix Scripting. Please help me to create a shell script which reads the xml file and from that i need to fetch a particular information. For example <SOURCE BUSINESSNAME ="" DATABASETYPE ="Teradata" DBDNAME ="DWPROD3" DESCRIPTION ="" NAME... (5 Replies)
Discussion started by: SmilePlease
5 Replies

5. UNIX for Dummies Questions & Answers

When reading a csv file, counter to read 20 lines and wait for minute then read next 20 till end

Hello All, i am a newbie and need some help when reading a csv file in a bourne shell script. I want to read 10 lines, then wait for a minute and then do a reading of another 10 lines and so on in the same way. I want to do this till the end of file. Any inputs are appreciated ... (3 Replies)
Discussion started by: victor.s
3 Replies

6. Shell Programming and Scripting

script to read XML file

Dear All, I have one log file and it contains lot of XML as below. ... (1 Reply)
Discussion started by: murtujak
1 Replies

7. Shell Programming and Scripting

Unix Script to read the XML file from Website

Hi Experts, I need a unix shell script which can copy the xml file from the below pasted website and paste in in my unix directory. http://www.westpac.co.nz/olcontent/olcontent.nsf/fx.xml Thanks in Advance... (8 Replies)
Discussion started by: phani333
8 Replies

8. Shell Programming and Scripting

Need a script that will read from 2 input file

Hi Everyone. I am new in this scripting world. I need to know about script that I can use on linux/sun operating systems. I have 2 input file. File 1: Its has an header information and then data in 2 different columns. File 2 : It has data in 9 different columns/ I need an script that... (3 Replies)
Discussion started by: syahmed
3 Replies

9. Post Here to Contact Site Administrators and Moderators

how to read a file till it encounters a blank line

Hi , I want to read a file starting with "*" up to till it encounters a blank line and to redirect this output to a different file.Plz suggest how to write a script for this. e.g:- * PK Sent Email (11.23) CALYPSO 1243215 9116457 NEW TRAD FAILED Nov 23 2007 9:34AM OASYS: DPS:... (0 Replies)
Discussion started by: adityam
0 Replies

10. Shell Programming and Scripting

need to read a file and keep waiting till it satisfies some condition

In my script i am writing to a counter file the no of processes i had started, that is each time i start a process, i will increment the content of counter file and also when the process ends i will decrement the content of the file. after this i do some other activities, by now i want to... (1 Reply)
Discussion started by: senthilk615
1 Replies
Login or Register to Ask a Question