[NTLUG:Discuss] sed awk question

Chris Cox cjcox at acm.org
Tue Aug 13 12:58:48 CDT 2002


Bobby Wrenn wrote:
..snip..

>
>from yet another post:
>
>sort -t, -k1 csg.data | awk -F, '
>{
>        if ($1 != lastsaved) {
>                print;
>                lastsaved=$1;
>        }
>}'
>
>I haven't tried this yet because I don't understand it.
>Should I make it a shell script and then give the output file as a redirect 
>">"? It looks like the input file name "scg.data" is imbedded in the script. 
>I can do that but is seems kludgy.
>
Sorry Bobby.. the csg.data was my test data file I made.  Replace that 
with your own or
redirect from stdin.







More information about the Discuss mailing list