sed - Adding lines to file -
I need help about adding some lines in the file; For dimensional, I grep the parameters of text and save it in File 1:
cellIdentity = "461" cellIdentity = "465" cellIdentity = "462" cellIdentity = "466" cellIdentity = "463" Selaidentiti = "467"
and now I resembles that file, you need to create another file 2:
cellIdentity = " 461 "cellIdentity =" 465 "Selaidentiti =" 468 "Selaidentiti =" 462 "Selaidentiti =" 466 "Selaidentiti =" 469 "Selaidentiti =" 463 "Selaidentiti =" 467 "Selaidentiti =" 460 "
Three new lines are out Knowledge. So basically, I need to add these three lines, the last points of 8 9, 000 is always the same in all three rows, and I do not know the same in other lines of the first two digits of whether it is possible to . I was trying with sed command but no fate. I'm using the solaris / bin / csh
Using awk
>
awk 'BEGIN {split ("880", a ""}} nr% 2 == 0 {t = $ 0; Sub (/.$/, a [++ i], $ 2); $ 0 = T RS $ 0} 1 "FS = \" OFS = \ "file Selaidentiti =" 461 "Selaidentiti =" 465 "Selaidentiti =" 468 "Selaidentiti =" 462 "Selaidentiti =" 466 "Selaidentiti =" 469 "Selaidentiti = "463" Selaidentiti = "467" Selaidentiti = "460"
explanations
-
FS = \ "OFS = \"
Define field separator"
-
BEGIN {partition (" 890 ", a," "}}
8,9,0 define $ /, a [++ i], $ 2) last character in the second column Change that array The -
1
same print
a
a
Comments
Post a Comment