Sponsored Content
Top Forums Shell Programming and Scripting Rewriting file paths in XML file within bash script Post 302412246 by omfgbunnies on Monday 12th of April 2010 06:00:31 AM
Old 04-12-2010
Thanks for this.

I've tested it but currently it's not replacing the data in the XML file - it writes a new file but that's it. Old file path present. :s

Code:
#!/bin/sh

oldFile=$1
newFile=${oldFile}.new    #just put a ".new" extension onto the oldFile

clear
echo --XML REWRITE--
echo oldfile is ${oldFile}
echo newfile is ${newFile}


sed 's@\(<pathurl>file:///Volumes/\)White%20Stage/1%20white%20capture/\(\(DE\|FR\|ES|GE\)_.*\.mov</pathurl>\)$@\1ctu/\3/4.\\ Final\\ Cut\\ Pro\\ Documents/Capture\\ Scratch/\2@' ${oldFile} > ${newFile}

#mv ${newFile} ${oldFile}

If I try this at the command line:

Code:
sed 's@\(<pathurl>file:///Volumes/\)White%20Stage/1%20white%20capture/\(\(DE\|FR\|ES|GE\)_.*\.mov</pathurl>\)$@\1ctu/\3/4.\\ Final\\ Cut\\ Pro\\ Documents/Capture\\ Scratch/\2@' DE_APPS_SLATE001_TK001-10h17m05s13-white.XML

It outputs this:

Code:
</xmeml></media></audio></track><enabled>TRUE</enabled>dex>1</clipindex>x>e></masterclipid>white%20capture/DE_APPS_SLATE001.mov</pathurl>


..which just further confuses me.


(I'm using OS X 10.6 Server by the way...)
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to remove xml namespace from xml file using shell script?

I have an xml file: <AutoData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Table1> <Data1 10 </Data1> <Data2 20 </Data2> <Data3 40 </Data3> <Table1> </AutoData> and I have to remove the portion xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" only. I tried using sed... (10 Replies)
Discussion started by: Gary1978
10 Replies

2. Shell Programming and Scripting

bash extract all occurences delimited from <name> and </name> tags from an xml file

I need to extract all text delimited from <name> and </name> tags from an xml file, but not only first occurence. I need to extract all occurences. I've tried with this command: awk -F"<name>|</name>" 'NF>2{print $2}' but it give only first occurence. How can i modify it? (18 Replies)
Discussion started by: ingalex
18 Replies

3. Shell Programming and Scripting

KSH - help needed for creating a script to generate xml file from text file

Dear Members, I have a table in Oracle DB and one of its column name is INFO which has data in text format which we need to fetch in a script and create an xml file of a new table from the input. The contents of a single cell of INFO column is like: Area:app - aam Clean Up Criteria:... (0 Replies)
Discussion started by: Yoodit
0 Replies

4. Shell Programming and Scripting

reading file paths from a text file

Hello all, I am new to scripting and here is what I want to get done. I need to run some processing on many files. I have a whole bunch of files among which there are a few that I am interested in. What I need to do is to write a script which reads the file paths from a text file. line by... (1 Reply)
Discussion started by: pavo-cristatus
1 Replies

5. Shell Programming and Scripting

Help required in Splitting a xml file into multiple and appending it in another .xml file

HI All, I have to split a xml file into multiple xml files and append it in another .xml file. for example below is a sample xml and using shell script i have to split it into three xml files and append all the three xmls in a .xml file. Can some one help plz. eg: <?xml version="1.0"?>... (4 Replies)
Discussion started by: ganesan kulasek
4 Replies

6. Shell Programming and Scripting

Comparing delta values of one xml file in other xml file

Hi All, I have two xml files. One is having below input <NameValuePair> <name>Daemon</name> <value>tcp:7474</value> </NameValuePair> <NameValuePair> <name>Network</name> <value></value> </NameValuePair> ... (2 Replies)
Discussion started by: sharsour
2 Replies

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

8. Shell Programming and Scripting

Is it possible to change paths inside a bash script?

i have some script with some paths inside it. The idea is to some files which is on desktop copy and move to another location. Problem is that inside script is similar to this: cp test1.zip /root/help/ because I allways have another zip files, does it possible to have some input which ask me... (18 Replies)
Discussion started by: tomislav91
18 Replies

9. UNIX for Beginners Questions & Answers

How to insert subnode in xml file using xmlstarlet or any other bash command?

I have multiple xml files where i want to update a subnode if the subnode project points to different project or insert a subnode if it doesn't exist using a xmlstarlet or any other command that can be used in a bash script. I have been able to update the subnode project if it doesn't point to... (1 Reply)
Discussion started by: Sekhar419
1 Replies
qc2movie(1)						    BSD General Commands Manual 					       qc2movie(1)

NAME
qc2movie -- Quartz Composer export tool SYNOPSIS
qc2movie inCompositionPath|repositoryCompositionIdentifier outMoviePath width height duration [--parameterKey1 value1 ...] DESCRIPTION
qc2movie is a tool that exports a Quartz Composer composition into a QuickTime movie by adding a track containing this composition. It is the command line equivalent of exporting a composition for the Quartz Composer application to a QuickTime movie. OPTIONS
inCompositionPath|repositoryCompositionIdentifier specifies which composition you want to export. Ar inCompositionPath is the path to the composition. Ar reposito- ryCompositionIdentifier is the identifier of a composition which lies in the Quartz Composer Repository. outMoviePath specifies movie file path to which the composition will be exported to width defines the width of the export movie height defines the height of the export movie duration defines the length of the export movie [--parameterKey1 value1 ...] passes composition specific parameters through the command line tool to the composition EXAMPLES
-To create a 10 second QuickTime movie containing a Quartz Composer track of the Particle System composition: qc2movie "/Developer/Examples/Quartz Composer Compositions/Particle Systems/Particle System.qtz" ~/example.mov 640 480 10 -To merge two video tracks (30s each) together using an image transition protocol abiding composition (Swing for example) in the Quartz Composer Repository (using its identifier: /swing): qc2movie /swing ~/merged-example.mov 640 480 60 --inputMoviePath1 ~/firstVideo.mov --inputMoviePath2 ~/secondVideo.mov --duration 2 -To apply an image filter protocol abiding composition to the video track of a movie: qc2movie /colorpencil ~/effect-example.mov 640 480 30 --input ~/Video.mov SEE ALSO
pcastaction(1) Mac OS July 9 2007 Mac OS
All times are GMT -4. The time now is 12:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy