PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > comp.unix.shell > cygwin
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.unix.shell Using and programming the Unix shell.

cygwin

Réponse
 
LinkBack Outils de la discussion
Vieux 27/12/2007, 23h14   #1
betoreyez@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut cygwin

why do this expresion to get every 10th line of a file dont work under
cygwin?

sed '0~10!d' file
  Réponse avec citation
Vieux 27/12/2007, 23h50   #2
Cyrus Kriticos
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: cygwin

betoreyez@gmail.com wrote:
> why do this expresion to get every 10th line of a file dont work under
> cygwin?
>
> sed '0~10!d' file


[GNU sed]

sed '10!d' file

--
Best regards | Be nice to America or they'll bring democracy to
Cyrus | your country.
  Réponse avec citation
Vieux 28/12/2007, 03h33   #3
Janis Papanagnou
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: cygwin

betoreyez@gmail.com wrote:
> why do this expresion to get every 10th line of a file dont work under
> cygwin?


Sorry, cannot tell.

>
> sed '0~10!d' file


But in case you are satisfied with a workaround using awk...

awk '!(NR%10)' file


Janis
  Réponse avec citation
Vieux 28/12/2007, 04h20   #4
Ed Morton
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: cygwin



On 12/27/2007 5:50 PM, Cyrus Kriticos wrote:
> betoreyez@gmail.com wrote:
>
>>why do this expresion to get every 10th line of a file dont work under
>>cygwin?
>>
>>sed '0~10!d' file


I've never seen that syntax before so I've no clue. Sorry.

> [GNU sed]
>
> sed '10!d' file
>


That would print THE 10th line of a file (just as sed -n '10p' would), not EVERY
10th line.

For anything other than simple substitutions, sed should be avoided. For this
job, the awk syntax is clear and simple:

awk '!(NR%10)' file

Ed.

  Réponse avec citation
Vieux 28/12/2007, 05h13   #5
Icarus Sparry
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: cygwin

On Thu, 27 Dec 2007 22:20:51 -0600, Ed Morton wrote:

> On 12/27/2007 5:50 PM, Cyrus Kriticos wrote:
>> betoreyez@gmail.com wrote:
>>
>>>why do this expresion to get every 10th line of a file dont work under
>>>cygwin?
>>>
>>>sed '0~10!d' file

>
> I've never seen that syntax before so I've no clue. Sorry.


>
> Ed.


It is a GNU sed'ism.
The "first~step" applies to every "step" lines, starting at "first".
I have never found the need to use it.
  Réponse avec citation
Vieux 28/12/2007, 07h37   #6
Cyrus Kriticos
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: cygwin

Ed Morton wrote:
>
>> [GNU sed]
>>
>> sed '10!d' file

>
> That would print THE 10th line of a file (just as sed -n '10p' would), not EVERY
> 10th line.


Right.
The article was within 5 minutes withdrawn.


--
Best regards | Be nice to America or they'll bring democracy to
Cyrus | your country.
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 13h47.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,11922 seconds with 14 queries