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

Yes we can.. What kind of changes you are trying to do?

I have one xml file and in that we have different event source defined and for
each event source we have different file mask . so , i have to read those file
mask and according to that pattern i have to pick files from other folder.

Could you please post the sample input xml file and the o/p format you need?

hey, what i have to do is to search for a file mask type and then to pick
file of that type from the input location, so i need to read that xml through shell script.

<?xml version="1.0" encoding="UTF-8"?>
<Sources>
  <StopFileName>/export/home/merge/cfg/MergeConfig.xml.stop</StopFileName>
  <DatabaseConnection>
    <TNSName>dgid1rr</TNSName>
    <Username>rte</Username>
    <Password>rted1</Password>
  </DatabaseConnection>
  <Logger>
    <LogMaxSize>1024</LogMaxSize>
    <LogFileNos>5</LogFileNos>
    <LogFilePath>/export/home/dgid1rr/merge/log</LogFilePath>
    <LogFileName>idr_merge_log</LogFileName>
    <LogLevel>Info</LogLevel>
  </Logger>
  <Source id="S1">
    <FileMask>idr_%YYYY%%MM%%DD%_%N%.idr</FileMask>
    <TimeLag>100</TimeLag>
    <Backup>True</Backup>
    <InputFilePath>/export/home/dgid1rr/cdr1/input</InputFilePath>
    <OutputFilePath>/export/home/dgid1rr/merge/cdr1/output</OutputFilePath>
    <BackupFilePath>/export/home/dgid1rr/merge/cdr1/backup</BackupFilePath>
    <ProcessOrder>FileTimestamp</ProcessOrder>
    <Enable>True</Enable>
    <MaxFiles>3</MaxFiles>
    <MaxRecs>25</MaxRecs>
  </Source>
  <Source id="S2">
    <FileMask>idr_%2N%.idr</FileMask>
    <TimeLag>300</TimeLag>
    <Backup>True</Backup>
    <InputFilePath>/export/home/dgid1rr/merge/cdr2/input</InputFilePath>
    <OutputFilePath>/export/home/dgid1rr/merge/cdr2/output</OutputFilePath>
    <BackupFilePath>/export/home/dgid1rr/merge/cdr2/backup</BackupFilePath>
    <ProcessOrder>OSTimestamp</ProcessOrder>
    <Enable>True</Enable>
    <MaxFiles>2</MaxFiles>
  </Source>
</Sources>


like this we can have more sources in the xml as well. and from each
sources , i have to read the file mask and on that basis i have to pick the
file from input directory.