|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
why do this expresion to get every 10th line of a file dont work under
cygwin? sed '0~10!d' file |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
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. |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
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. |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
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. |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
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. |
|
![]() |
| Outils de la discussion | |
|
|