Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Nov 2008 09:45:28 -0800
From:      prad <prad@towardsfreedom.com>
To:        freebsd-questions@freebsd.org
Cc:        Drew Tomlinson <drew@mykitchentable.net>
Subject:   Re: Regular Expression Help
Message-ID:  <20081130094528.3bdf8782@gom.home>
In-Reply-To: <4932CA0D.8080109@mykitchentable.net>
References:  <4932CA0D.8080109@mykitchentable.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 30 Nov 2008 09:14:53 -0800
Drew Tomlinson <drew@mykitchentable.net> wrote:

> I'm attempting to take an ldiff file and flip first/last name order.
>
you can try using sh (i'm using zsh)

file data.txt has the following:

joe brown
joe brown-smith


file t.sh is coded as:

#!/usr/local/bin/zsh
#
while read var; do
    f=${var% *}
    l=${var#* }
    echo $l, $f
done < $1


then you just run it as 
t.sh data.txt

-- 
In friendship,
prad

                                      ... with you on your journey
Towards Freedom
http://www.towardsfreedom.com (website)
Information, Inspiration, Imagination - truly a site for soaring I's



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20081130094528.3bdf8782>