Some of the entries have 2 word users, others have 3 word users.  If
you want to see "eww", this is what I ended up running:
cat token.rpt |grep -v Unassigned |cut -f2- -d' ' | rev | awk '{print
$2,$8,$10,$11,$12}' | rev > expiring.txt

I wasn't sure how to get awk to give me everything after a certain
point, so I used cut to get the second field and all following fields,
then reversed it since the name field was the only variable length
field.  Used awk to grab the dates and the names in reverse, then
flipped it back.

I had to do a little more cleanup to make it presentable, like finding
out that ^@ in vim is a null char and that to type it I needed to hit
"ctrl+v 000"

Whew, that was fun.  :)

On Tue, Aug 4, 2009 at 7:03 AM, Steven S. Critchfield<cri...@basesys.com> wrote:
>
> ----- "Don Delp" <nesma...@gmail.com> wrote:
>> Another option (using sed) hit me in the shower.  In my case, each
>> row
>> has a newline followed by "-->" before the rest of the data for that
>> user.  I can use sed to replace '\n-->' with ' ' and have all my data
>> in one row per entry.  From there, I can grep it the way I expect to
>> and then use cut to just get the fields I want.
>>
>> I'm going to ask my windows-using coworkers what options they have to
>> manage data like this.  I expect to hear: "Get the new guy to do it
>> manually in notepad."  :)
>
> Using cut is eeww. Try awk.
>
> sed 's/\n-->/ /' <in_log |grep -v 'username to be rid of' | awk '{print $2}'
>
> Using awk will split on whitespace normally. Then you just need to know what
> column number you want to print. Granted it won't work well if you have
> conditional columns that occasionally don't have content, or fields with
> allowable spaces in them.
>
>
>
> --
> Steven Critchfield cri...@basesys.com
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"NLUG" group.
To post to this group, send email to nlug-talk@googlegroups.com
To unsubscribe from this group, send email to 
nlug-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/nlug-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to