I tried running your code and realized that it prints out the output, rather than saving the file. How come when I do a
command, it doesn't create an output file?
---------- Post updated at 10:58 PM ---------- Previous update was at 10:29 PM ----------
nevermind.... made a dumb mistake. vgersh99 thanks for the help!
---------- Post updated at 11:46 PM ---------- Previous update was at 10:58 PM ----------
sorry for bringing back what I thought was a "dead thread"
I realized that some of the xml files has the following lines:
<xControl xId="" xType="Label" xRow="1" xColumn="3" xCssStyle="margin-left:20px;margin-right:3px;">
Therefore, both margin-left and margin-right would need to be changed. What I did was create the following bash file:
nawk -f jl1.awk myFile.xml > myFile.tmp
mv myFile.tmp myFile.xml
nawk -f jl2.awk myFile.xml > myFile.tmp
mv myFile.tmp myFile.xml
where jl1.awk is the following:
match($0,"margin-right:[^;][^;]*") {
str=substr($0,RSTART,RLENGTH)
gsub("[^0-9]","",str)
str-=(str/4)
$0=substr($0,1,RSTART-1) "margin-right:" str "px;\">"
substr($0,RSTART+RLENGTH+1)
}
1
and jl2.awk is:
match($0,"margin-left:[^;][^;]*") {
str=substr($0,RSTART,RLENGTH)
gsub("[^0-9]","",str)
str-=(str/4)
$0=substr($0,1,RSTART-1) "margin-left:" str "px;"
substr($0,RSTART+RLENGTH+1)
}
1
jl1.awk seems to work fine, but when I run jl2.awk, the margin-right information is deleted. Why is this?