I have a file containing numbers in the following form:
(it has 4 columns and 5 rows and the 3rd row is an empty line)

(0.761249,0)  (0,-0.42632) 
 (0,0.42632)  (0.238751,0) 

 (0.636502,0)  (0,-0.42632) 
 (0,0.42632)  (0.363498,0)

and I would like to have like this:
(and there would be a number "2" in the 1st, 4th rows)

2
 0.761249 0 0 -0.42632 
 0 0.42632 0.238751 0 
 2
 0.636502 0 0 -0.42632 
 0 0.42632 0.363498 0

Recommended Answers

All 3 Replies

sed '1 i\ ' will add an empty line above the first line (that's a one and not a low L, there's a space between \ and last ') sed 's/^$/2/' will substitute any empty lines for a 2

hello
can some one suggest me about this Shell Scripting ?

Hi John,

What do you mean your question doesnt make much sense!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.