cygwin
am 28.12.2007 00:14:43 von betoreyezwhy do this expresion to get every 10th line of a file dont work under
cygwin?
sed '0~10!d' file
why do this expresion to get every 10th line of a file dont work under
cygwin?
sed '0~10!d' file
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.
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
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.
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.
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.