0

Hi everyone,

I am trying to change hundreds of data files using sed command. Text file1 have 10 lines which look like the following

{ x=34280; y...}
{ x=34281; y...}
{ x=34282; y...}
{ x=34283; y...}
{ x=34284; y...}
{ x=34285; y...}
{ x=34286; y...}
{ x=34287; y...}
{ x=34288; y...}
{ x=34289; y...}

What I like to do is to add 10 times j to each of the x values and print it to the same text file. Here is my trial:

#!/bin/bash

for ((  i = 0 ;  i <= 9;  i++  ))
do
j=1
sed -e   's/'3428$i'/`'3428$i'+10*j`/g'  file1 >  file1_new
mv file1_new file1
done

What I am getting is:

`{ x=34280+10*j`

instead.
any suggestion?

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by SakuraPink
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.