Javier Jerónimo


Nota mental: ‘tar’ de ficheros listados con ‘grep’

05 Jan 2013 » macos

Para no volver a buscarlo:

grep -Ilr 'algo' sitio > fichero
grep -Ilr 'otro' sitio >> fichero
tar cjf comprimido.tar.bz2 -T fichero

La clave está en el modificador ‘-T’ de tar:

-T filename

In x or t mode, tar will read the list of names to be extracted from filename. In c mode, tar will read names to be archived from filename. The special name “-C” on a line by itself will cause the current directory to be changed to the directory specified on the following line. Names are terminated by newlines unless –null is specified. Note that –null also disables the special handling of lines containing “-C”.

Ojo, que esto lo he ejecutado en OS X…