Mailinglist Archive: opensuse (4053 mails)

< Previous Next >
[SLE] splitting a string
  • From: pierre@xxxxxxxxx
  • Date: Thu, 9 Aug 2001 07:40:10 +0200 (CEST)
  • Message-id: <15218.8762.71116.377407@xxxxxxxxxxxxxx>
S.Toms writes:
> Quick question for everyone, I want to beable to split a string that
> contains a colon at the colon, for example
>
> 4.23.242.12:2323
>
> I'd like to remove the colon and whatever follows it. Unfortunately, I
> havn't figured out a way to do it with what I know.
>
echo 4.23.242.12:2323|cut -f1 -d:
d: specifies delimiter
f1 specifies field kept

If this needs be mingled with some processing, python is the solution.
Believe it or not.
--
Pierre Imbaud <pierre@xxxxxxxxx>
12 Rue des Bosquets 91480 Quincy Sous Sénart France
Tel: 01 69 00 94 57 Fax 09 47


< Previous Next >
References