Afficher un message
Vieux 23/08/2006, 08h04   #4
Rakesh Sharma
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: finding consecutive repetitive lines


osiris@abydos.kmt wrote:
> I have 100+ files of about 150-200 lines each.
> Each file has 8 aligned fields and could be separated with /usr/bin/cut.
>
> After reading a line in a loop, I cut FIELD1, FIELD4 and awk FIELD5.
> I then use FIELD1 to get the line that was just read and
> the following 4 lines with:

......[snip]

> To clarify, I want all lines printed if $FIELD4 and $FIELD5
> are the same in five successive lines.
>




sed -e '
/regex/!d
s/^/\
/

:loop
$d;N
/.*\n[^ \n]* [^ \n]* [^ \n]* \([^ \n]* [^ \n]*\) [^\n]*\n[^ \n]* [^
\n]* [^ \n]* \1 [^\n]*$/!d
s/\n/&/5;tend
bloop

:end
s/.//
' yourfile

  Réponse avec citation
 
Page generated in 0,04340 seconds with 9 queries