On 10/30/2007 3:48 PM,
mostro713@gmail.com wrote:
> Hi.
>
> I have a list of IP addresses (one per line) in a text file. I need
> to surround them with pipe symbols and include a single space in
> between the first and last number.
>
> For example:
>
> [before]
> 192.168.1.1
> <space>
> 192.168.1.2
> 192.168.1.3
> <space>
> 192.168.1.4
> 192.168.1.5
>
> [after]
> | 192.168.1.1 |
> | 192.168.1.2 |
> | 192.168.1.3 |
> | 192.168.1.4 |
> | 192.168.1.5 |
>
> I tried a few different sed line that didn't work out so well
>
> Thanks in advance....
>
sed 's/\(.*\)/| \1 |/' file