[clug] Two (perhaps simple) shell questions.

Andrew Janke a.janke at gmail.com
Mon Aug 17 19:33:01 MDT 2009


Hi all,

Two questions.

1) I had a need (really) to remove every second newline from a file
the other day and all I could think of was this:

   $  awk 'ORS=NR%2?" ":"\n"' ...

That is replace the newline with a space.  Is there a "better way"?.
tr came to mind but I didn't get far.


2) Suppose I am doing this:

for i in `ls *.mnc`;
do
   <program> $i $i.out
done

In this case <program> is not dependant on any of the other results
and I often have a large number of them to do. I also happen to have a
machine with 8 CPU's. So is there a simple C/L function/program/thing
that will allow me to do this:

for i in `ls *.mnc`;
do
   do8ofthisatonce <program> $i $i.out
done

Currently for "real" things I use Sun Grid Engine so do8ofthisatonce
is qbatch, where qbatch is my own little dirty perl interface to qsub
(http://mavis.anu.edu.au/scripts/qbatch) so that you can use SGE like
the old UCSF batch. Still this is not quite what I want as I'd like to
know if there is something that will just work on the localhost for
quick and dirty C/L hacking.

My only thought was to use make -j8 or the likes...


Thanks

--
Andrew Janke
(a.janke at gmail.com || http://a.janke.googlepages.com/)
Canberra->Australia    +61 (402) 700 883


More information about the linux mailing list