Hi.. I'm facing a trouble in replacing two blank lines in a file using shell script...
I used sed to search a line and insert two blank lines after the searchd line using the following sed command. sed "/data/{G;G;}/" filename . In the file, after data tag, two lines got inserted blank lines.. Now i'm trying to insert 2 different data into the same blank lines.. But cudn't get the command for that... Any help wud b appreciated...
to create two blank lines after searching for the tag <data>.... After creating blank lines I tried to replace them with two different data, but couldn't get the result.... sed could be used to make a single change to many lines only..
Its coming from a flat file and it will be choosed depending upon the value of <data> in the sed command.
after inserting the statements, the results would be like:
where $data1 and $data2 will be taken dynamically from another flat file using a loop.
These are two lines of data which i need to add...
---------- Post updated at 04:02 PM ---------- Previous update was at 03:41 PM ----------
I tried to use s/text1/text2/g... but here the blank lines are getting replaced by the same piece of line...
---------- Post updated 12-03-11 at 09:48 AM ---------- Previous update was 12-02-11 at 04:02 PM ----------
Can we use two different sed to replace the first occurrence of blank statements with data?
I tried using sed -e 's/^$/mydata/' filename... but this command replaced both the blank statements with my data... is there any other option to replace the first occurrence of blank statement with my data?