Sponsored Content
Top Forums Shell Programming and Scripting reading and searching xml element text in script Post 90577 by forevercalz on Thursday 24th of November 2005 02:31:28 AM
Old 11-24-2005
Java reading and searching xml element text in script

well i have this xml file here: this file is called filereader.xml
<?xml version="1.0" encoding="UTF-8"?>
<file>
<file1>
<filecopy>/new/test/thefile.txt</filecopy>
<filecopy>/new/test/thefile2.ppt</filecopy>

</file1>
</file>

i need to write the script that search for the Bold text inside the xml without using java. The underlined part is the directory... so the script will first look into the tag--filecopy..then look into a basedirectory which i created called checkdirectory after that it will look into /new/test/ in the tag which is also a directory to locate the file.

Eg. thefile.txt is in checkdir/new/test/thefile.txt
and thefile2 is in checkdir/new/thefile2.txt

i have a code here....but it will only capture file in the tag...it will not look into /new/test folder...can someone help me out?

the coding i have is :
#!/bin/sh

sed -e '/filecopy/ !d' -e 's!<filecopy>\([^<]*\)</filecopy>!\1!' filereader.xml | while read file; do
if [ -f "../checkdir/${file}" ]; then
echo "File exists : ${file}"
else
echo "File not exist : $${file}"
fi
done

exit 0

Last edited by forevercalz; 11-24-2005 at 09:37 PM..
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

reading and searching xml element text in script

well i have this xml file here: this file is called filereader.xml <?xml version="1.0" encoding="UTF-8"?> <file> <file1> <filecopy>thefile.txt</filecopy> <filecopy>thefile2.ppt</filecopy> </file1> </file> hi..i got this problem....hmm how do i write a... (6 Replies)
Discussion started by: forevercalz
6 Replies

2. Shell Programming and Scripting

Searching XML tag in a script

Hey, I need to parse the following XML to just grab the Customer ID. Is there any RegEx that can achieve this ? So in this example, the script just return 0000109654, as the output. Even if it involves awk, sed please let me know. ************ <?xml version="1.0" encoding="UTF-8"?>... (1 Reply)
Discussion started by: abhandari
1 Replies

3. Shell Programming and Scripting

reading XML datas via Shell Script

Hi all, i have an xml file with this fomat(exactly) : <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE TestSuite SYSTEM "../../CallCrt.dtd"> <TestSuite description="Diameter"> <FileReference FileName="DMI_FC01.xml"/> <!--<FileReference FileName="DMI_FC02.xml"/> -->... (1 Reply)
Discussion started by: freepal
1 Replies

4. UNIX Desktop Questions & Answers

read XML xml element with REGEXP

Hi, I would need to read an xml element from an xml file to a local variable. Please could you help me with a shell script to get so? Considering that I have a file called file.xml like below: <header> <description>This is the description</description> <content>This is the... (2 Replies)
Discussion started by: oscarmon
2 Replies

5. Shell Programming and Scripting

reading xml attributes with shell script

Hi, Iam new to shell scripting.I have below urgent requirement I want to read attributes (transaction,documentmode) in xml tag with shell scripting and create a filename with these attribues Xml : <PURCHASE_10 partner="food" version="1.50" timestamp="2009-03-10T09:56:55"... (3 Replies)
Discussion started by: swetha123
3 Replies

6. Shell Programming and Scripting

Find if XML element has a matching required element

I want to check if every <Part> element has corresponding <Description> in this sample XML. ....<Lot Of XML> <Inv lineNumber="2"> <Item> ... (4 Replies)
Discussion started by: kchinnam
4 Replies

7. Shell Programming and Scripting

Reading xml tags from ksh script

Hi, I have an XMl file, below is sample: <TRANSFORMATION DESCRIPTION ="Created by:- " NAME ="LKP_FT_T_FILEK" OBJECTVERSION ="1" REUSABLE ="YES" TYPE ="Lookup Procedure" VERSIONNUMBER ="1"> </TRANSFORMATION> I need to read the tag, and if the tag is TRANSORMATION, i want to check the Type... (6 Replies)
Discussion started by: kedar_laveti
6 Replies

8. UNIX for Dummies Questions & Answers

Reading XML file and print the values in the text file using Linux shell script

hi guys, i want help... Reding XML file and print the values into the text file using linux shell script file as per below xml file <sequence> <Filename>aldorzum.doc</Filename> <DivisionCode>US</DivisionCode> <ContentType>Template</ContentType> <ProductCode>VIMZIM</ProductCode> </sequence>... (1 Reply)
Discussion started by: sravanreddy
1 Replies

9. Programming

How to write in other language in text/xml file by reading english text/xml file using C++?

Hello Team, I have 2 files.one contains english text and another contains Japanese. so i have to read english text and replace the text with Japanesh text in third file. Basically, I need a help to write japanese language in text/xml file.I heard wstring does this.Not sure how do i write... (2 Replies)
Discussion started by: SA_Palani
2 Replies
SPLASHY(1)						 Splashy POSIX boot splash system						SPLASHY(1)

NAME
Splashy - a user-mode, POSIX and LSB compliant, boot splashing system for UNIX. SYNOPSIS
splashy { boot | shutdown | test | preview } splashy_chvt { TTY_NUMBER } DESCRIPTION
Splashy displays an image and a progress bar at boot time. When called as splashy_chvt, it allows the same functionality as the UNIX command chvt. OPTIONS
boot Does boot sequence. See EXAMPLES. shutdown Does shutdown sequence. See EXAMPLES. test, preview Use to test splashy without having to reboot the system. this shows a progressbar continuously moving as well as the current image for the currently selected theme. See EXAMPLES. EXAMPLES
"/sbin/splashy test" Used to test splashy. Useful for testing new themes. "/sbin/splashy boot" Used when booting your system. This is run automatically by a initrc script during boot. "/sbin/splashy shutdown" Similar in spirit to boot, but run during shutdown. This is run automatically by a initrc script during shutdown. FILES
/etc/splashy/config.xml Main configuration. defines how splashy should be setup. /etc/splashy/themes/default/config.xml Default theme. defines how the images displayed by splashy should be setup, their location and other theme-related variables. NOTES
To use splashy as chvt, make a symbolic link from splashy's location to a new path. i.e.: cd /sbin; ln -s splashy splashy_chvt SEE ALSO
splashy_config(1), splashy_update(1), splashy-config.xml(5), splashy-theme.xml(5) AUTHORS
Luis Mondesi <lemsx1@gmail.com> perl v5.12.1 2010-07-05 SPLASHY(1)
All times are GMT -4. The time now is 04:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy