| Newsgroups |
gmane.editors.sed.user |
| Message-ID |
<[email protected]> |
This seems to work
cat file | sed "N;N;s/\n/ /g"
This assumes no blank lines.
Joel
On Mon, 2017-05-22 at 18:16 -0600, 'Van Handel' [email protected] [sed-
users] wrote:
> Hello. This is on Linux. I have a command that returns many
>
> attributes for each set top box on a headend, but I only need the
>
> MacAddr, HubId, and Model.
>
> To get that info, I pipe the output to grep & sed like this to leave
> only
> the text I care about:
>
> output | egrep "Mac Address|Hub Id|Model" | sed "s/^.*[ ]//"
>
> That gives me vertical output like below (many more lines than this):
>
> 00:12:34:56:78:9A
>
> 101
>
> 123456
>
> 00:21:CE:54:22:7A
>
> 101
>
> 876543
>
> 00:21:32:43:54:87
>
> 1
>
> 234
>
> I would like to combine this output 3 lines at a time, like:
>
> 00:12:34:56:78:9A 101 123456
>
> 00:21:CE:54:22:7A 101 876543
>
> 00:21:32:43:54:87 1 234
>
> Is there a way to do this using sed?
>
> Thanks,
>
> Dave
>
> [Non-text portions of this message have been removed]
>
>