Re: awk quries
- From: "John L" <jl@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 29 Jun 2005 07:24:03 +0100
"NewBie" <leongyc@xxxxxxxxx> wrote in message news:42c238d8$1@xxxxxxx
> Example there is a file called data.txt consists of:
>
> /usr/local/record
> /usr/local/record
> /usr/local/record
> /usr/local/record
>
>
> Now I just want to have an output with only a single line of:
>
> /usr/local/record
>
> How to go about it with awk?
>
> If I will to print only 2nd line, is it possible also?
>
Please don't top-post. It makes it harder for people to help you.
To simulate the Unix tool, uniq, and print only the first of
successive duplicate lines:
$0 !~ lastline { print }
{ lastline = $0 }
To print only the second line (or record):
NR == 2 { print }
--
John.
.
- References:
- awk quries
- From: NewBie
- Re: awk quries
- From: hq00e
- Re: awk quries
- From: NewBie
- awk quries
- Prev by Date: Re: awk quries
- Next by Date: Re: awk quries
- Previous by thread: Re: awk quries
- Next by thread: Re: awk quries
- Index(es):
Relevant Pages
|