linux - How to parse numbers from an array in codes like this? -
i need parse numbers codes this:
p1 <- c(1, 2, 100, 23, 0.12, 0.03, 0) p2 <- c(100, 200, 1, 23, 0.12, 0.03, 0) p30 <- c(100, 200, 1, 23, 0.12, 0.03, 0) p300 <- c(100, 200, 1, 23, 2, 1, 0) more variables starts p... other codes...
the results this:
1 2 100 23 0.12 0.03 0 100 200 1 23 0.12 0.03 0 100 200 1 23 0.12 0.03 0 100 200 1 23 2 1 0
in each row represent array of variable.
i tried sed
, awk
, doesn't work out it. have ideas this? thanks!
using gnu sed (for -r , eres):
$ cat file p1 <- c(1, 2, 100, 23, 0.12, 0.03, 0) p2 <- c(100, 200, 1, 23, 0.12, 0.03, 0) p30 <- c(100, 200, 1, 23, 0.12, 0.03, 0) p300 <- c(100, 200, 1, 23, 2, 1, 0) $ sed -r 's/.*\(|[,)]//g' file 1 2 100 23 0.12 0.03 0 100 200 1 23 0.12 0.03 0 100 200 1 23 0.12 0.03 0 100 200 1 23 2 1 0
Comments
Post a Comment