|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
How can I run this command, repquota -v /home | awk '{if ($3 > $4) print $0 }' but prevent it outputting lines starting with a #ddddd ie #11779 -- 8 0 0 2 0 0 It would sure make life easier TIA Owen |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
Owen wrote: > How can I run this command, > > repquota -v /home | awk '{if ($3 > $4) print $0 }' Try: if ($3 > $4 || substr($0,1,1) != "#") > but prevent it outputting lines starting with a #ddddd ie > > #11779 -- 8 0 0 2 0 0 > > It would sure make life easier > > TIA > > > Owen |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
RolandRB wrote: > Owen wrote: > > How can I run this command, > > > > repquota -v /home | awk '{if ($3 > $4) print $0 }' > > Try: if ($3 > $4 || substr($0,1,1) != "#") Nearly, but thanks for the clue, this worked repquota -v /home | awk '{if (($3 > $4) && (substr($0,1,1) != "#")) print $0 }' Thanks Owen > > > but prevent it outputting lines starting with a #ddddd ie > > > > #11779 -- 8 0 0 2 0 0 > > > > It would sure make life easier > > > > TIA > > > > > > Owen |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
Owen wrote: > RolandRB wrote: > > Owen wrote: > > > How can I run this command, > > > > > > repquota -v /home | awk '{if ($3 > $4) print $0 }' > > > > Try: if ($3 > $4 || substr($0,1,1) != "#") > > > Nearly, but thanks for the clue, this worked > > repquota -v /home | awk '{if (($3 > $4) && (substr($0,1,1) != "#")) > print $0 }' > > > Thanks > > Owen Yes "&&" and not "||" - duh! It was before my morning cup of coffee. > > > > > > but prevent it outputting lines starting with a #ddddd ie > > > > > > #11779 -- 8 0 0 2 0 0 > > > > > > It would sure make life easier > > > > > > TIA > > > > > > > > > Owen |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
Owen wrote: > RolandRB wrote: > > Owen wrote: > > > How can I run this command, > > > > > > repquota -v /home | awk '{if ($3 > $4) print $0 }' > > > > Try: if ($3 > $4 || substr($0,1,1) != "#") > > > Nearly, but thanks for the clue, this worked > > repquota -v /home | awk '{if (($3 > $4) && (substr($0,1,1) != "#")) > print $0 }' > > > Thanks > > Owen You could have piped it grep to get rid of those lines like this: repquota -v /home | awk '{if ($3 > $4) print $0 }' | grep -v ^# ....but then you already knew that, didn't you? |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
2006-12-2, 22:58(-08), Owen:
> > How can I run this command, > > repquota -v /home | awk '{if ($3 > $4) print $0 }' > > but prevent it outputting lines starting with a #ddddd ie > > #11779 -- 8 0 0 2 0 0 > > It would sure make life easier [...] repquota -v /home | POSIXLY_CORRECT=1 awk '$3 > $4 && ! /^#[0-9]{5}/' -- Stéphane |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
RolandRB wrote: > Owen wrote: > > RolandRB wrote: > > > Owen wrote: > > > > How can I run this command, > > > > > > > > repquota -v /home | awk '{if ($3 > $4) print $0 }' > > > > > > Try: if ($3 > $4 || substr($0,1,1) != "#") > > > > > > Nearly, but thanks for the clue, this worked > > > > repquota -v /home | awk '{if (($3 > $4) && (substr($0,1,1) != "#")) > > print $0 }' > > > > > > Thanks > > > > Owen > > You could have piped it grep to get rid of those lines like this: > > repquota -v /home | awk '{if ($3 > $4) print $0 }' | grep -v ^# > > ...but then you already knew that, didn't you? I tried piping it thru a grep --exclude=/something/ . I just looked up man grep and have no idea why I did that. Time to go to bed! Thanks again Owen |
|
|
|
#8 |
|
Messages: n/a
Hébergeur: |
"Owen" <xemoth@gmail.com> wrote in message news:1165129096.825454.209430@79g2000cws.googlegro ups.com... > > How can I run this command, > > repquota -v /home | awk '{if ($3 > $4) print $0 }' > > but prevent it outputting lines starting with a #ddddd ie > > #11779 -- 8 0 0 2 0 0 gawk --re-interval '$3>$4&&$1!~/#[0-9]{5}/' Regards Dimitre |
|
|
|
#9 |
|
Messages: n/a
Hébergeur: |
Owen wrote: > RolandRB wrote: > > Owen wrote: > > > RolandRB wrote: > > > > Owen wrote: > > > > > How can I run this command, > > > > > > > > > > repquota -v /home | awk '{if ($3 > $4) print $0 }' > > > > > > > > Try: if ($3 > $4 || substr($0,1,1) != "#") > > > > > > > > > Nearly, but thanks for the clue, this worked > > > > > > repquota -v /home | awk '{if (($3 > $4) && (substr($0,1,1) != "#")) > > > print $0 }' > > > > > > > > > Thanks > > > > > > Owen > > > > You could have piped it grep to get rid of those lines like this: > > > > repquota -v /home | awk '{if ($3 > $4) print $0 }' | grep -v ^# > > > > ...but then you already knew that, didn't you? > > > I tried piping it thru a grep --exclude=/something/ . I just looked up > man grep and have no idea why I did that. Time to go to bed! > > Thanks again You could also use awk's regular expression filter (or whatever it is called) with: awk '/^[^#]/ && $3 > $4' The above should work, I think. |
|
![]() |
| Outils de la discussion | |
|
|