Topic: Computers What does that do?

(link)

1:47pm, Tuesday 26 October 2004 (Updated 9:21pm, Tuesday 26 October 2004)

sed '0~2d' test > $$.1 ; sed '1~2d' test > $$.2 ; \
  paste -d ' ' $$.1 $$.2 ; rm $$.1 $$.2
Optimisations welcomed. I'd particularly like to get it all into a single sed call without using temporary files.

Update:

sed -n 'N; s/\n/ /; p' test
Fab, a one-liner. Unfortunately the shorter
sed 'N; s/\n/ /' test
behaves differently with GNU sed and Tru64 sed. :-(

back to main

<-
 Topic:    
->

Powered by Personal Weblog.

January 2018
Sun Mon Tue Wed Thu Fri Sat
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
Dec   Feb

[RSS]

 


 


Dave Holland <dave@biff.org.uk>
$Id: index.php,v 1.75 2010-07-09 22:15:04 dave Exp $