Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- ##############################################################
- #dirty script hopefully will replace 2 constant parameters as described below
- #######
- #target.xml is the file in which 2 parameters will be replaced
- #from file1.txt and file2.txt
- #the two parameters are constant xxx and yyy
- #######
- if [ ${1} = "target.xml" ]
- then
- echo "MESSAGE: target xml given"
- else
- echo "MESSAGE: target xml not given"
- fi
- #######just throwing out the strings
- NUMBER1=`wc -l file1.txt`
- STRING1=`cat file1.txt`
- COUNT=0
- echo "MESSAGE: Found ${NUMBER1} number of strings to replace"
- echo "MESSAGE: The strings are ${STRING1}"
- ######using sed to replace the constant####
- for i in `cat file1.txt` [[I need an AND operator here]]] j in `cat file2.txt`
- do
- TARGET1=${i}
- TARGET2=${j}
- echo "replacing xxx with ${TARGET1}"
- echo "replacing yyy with ${TARGET2}"
- sed s/xxx/${TARGET1}/g s/yyy/${TARGET2}/g ${1}> ${TARGET1}_output.xml
- done
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement