Re: [SLUG] sed

From: Scotty Logan (scotty@catbert.net)
Date: Thu Jun 03 2010 - 14:53:43 EDT


On Jun 2, 2010, at 7:23 PM, Eben King wrote:
> I'm pretty good at regexes, but programming in sed is where I break down. How does one convert this:
>
> A1
> B1
> A2
> B2
> A3
> B3
> ...
>
> into this:
>
> A1 B1
> A2 B2
> A3 B3
> ...

Assuming the data's exactly like the example:

% awk '/^A/{s=$1;}/^B/{print s,$1}' data-file

  Scotty

-- 
Never take life seriously - Nobody gets out alive anyway

----------------------------------------------------------------------- This list is provided as an unmoderated internet service by Networked Knowledge Systems (NKS). Views and opinions expressed in messages posted are those of the author and do not necessarily reflect the official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 15:45:51 EDT