[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: semente uma linha
From: |
voyeg3r |
Subject: |
Re: semente uma linha |
Date: |
Mon, 24 Mar 2008 15:09:23 -0000 |
User-agent: |
eGroups-EW/0.82 |
cat /caminho/para/o/arquivo | sed -n 6p > resultado
ou
var=`cat /caminho/para/o/arquivo | sed -n 6p`
--- Em address@hidden, "Tiago Barcellos Peczenyj"
<tiago.peczenyj@...> escreveu
>
> existem pelo menos 3 formas.
>
> head -6 arquivo | tail -1
> sed -n '6{p;q}'
> awk 'NR == 6 { print ; exit ; }'
>
> vc pode inventar outras.
>
> 2008/3/23 Daniel Cardoso <daniel@...>:
> >
> >
> >
> >
> > Pessoal,
> >
> > Estou trabalhando em um scrpt e parei no seguinte problema. Como fazer
> > para buscar somente a linha 6 de um arquivo texto. Uma solução que
> > encontrei foi.
> >
> > cat -n arquivo.log | grep 6 | awk -F" " '{print $2}'
> >
> > Quebra um galho... Será que tem como ficar mais profissional?
> >
> > Abraço.
> >
> > Daniel
> >
> >
>
>
>
> --
> Tiago B Peczenyj
> Linux User #405772
>
> http://peczenyj.blogspot.com/
> "what does not kill us makes us stronger"
>