awk - Save lines to separate files -


i have file --> http://wklej.org/id/1403118/

creating separate files

awk '/o[0-9]{5}/{print > $0}' file 

in each file want put model , subsequent lines.

an example of first 2 files

file name --> o00001(odjazdxyz)

o00001(odjazdxyz) g91 g28 y0 z0  g90  m99 

file name --> o00001(049-479514)

o00001(049-479514) / m97 p1 (fr25)  m97 p2 (fr8)  m30  n1 t2 g43 h02 g54 m06  g00 x1. y-12.5 z1. m08  s890 m03  g01 x-58. f250.  y12.5  x1.  g00 y-12.5 z0  g01 x-58.  y12.5  x2. m09  g00 y170. z300. n1 m99   n2 t8 g43 h08 g54 m06 (fr8)  g00 x0 y57. z2. m08  s2785 m03  g01 z-4. f250. m09  g00 z2. y380. n2 m99  

this should work.

awk '/o[0-9]/{out=$0} out{print > out}' file 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -