I have a file which contains so many values which ends with a string px
. I need to find all those values, multiple them with 0.43
and again write them to the file with the substring pt
instead of px
How do I achieve this ??
eg string from the file:
.ClassOne
{
margin: .35em 5px;
overflow: hidden;
padding: 0 1.4em 0 .5em;
position: relative;
text-overflow: ellipsis;
white-space: nowrap;
}
.ClassTwo
{
border: 7px solid #FFF;
border-top-color: #000;
position: absolute;
right: 6px;
top: .95em;
}
.ClassThree
{
bottom: 5px;
height: 1px;
left: 1em;
position: absolute;
right: 2em;
}
To find all the values that ends with px, and convert them to points by multiplying with 0.43
and write them back to the file.
Example: 5px = 2.15pt, -9px = -3.87pt
How to achieve this using a single line command line in unix?? Since I am new to shell scripting, I need some help. All I know is that it can be achieved using sed -i
.