[ale] another scripting question

Asif asife at mindspring.com
Wed Dec 1 10:55:54 EST 1999


Try
    sed 's/\(.*\):x.*/\1/' <fileIn >fileOut      <--- works for ur passwd file.

Personally, I find awk easier.
   awk -F":" '{print $1}' <fileIn >fileOut

good luck.
Asif

Ben Phillips wrote:

> If I want sed to delete everything on every line of a file AFTER the first
> word on the line, how would I do that?  Given sed's similarity to vi, it
> seems like this shouldn't be hard.  Say I'm stripping a passwd file down to
> just the usernames, so every line is like:
>
> joe:x:100:100:group:blahblahblah
> dave:x:100:100:group:blahblahblah
> bob:x:100:100:group:blahblahblah
>
> and I want:
>
> joe
> dave
> bob
>
>                       __   _                 "If pro is opposite of con,
> Ben Phillips         /  '_' )         ,,,    then what is the opposite of
> pynk at cc.gatech.edu   |  | ()|||||||||[:::)   progress?  Congress!"
>                      \__.-._)         '''     -- men's restroom, House of
>                                               Representatives, Washington






More information about the Ale mailing list