From: "Alexei V. Mezin" <mezin@ntmdt.ru>
To: "культурный офтопик" <smoke-room@lists.altlinux.org>
Subject: Re: [room] [JT] Re: Помогите со скриптиком.
Date: Thu, 28 Sep 2006 15:24:02 +0400
Message-ID: <451BB0D2.4020604@ntmdt.ru> (raw)
In-Reply-To: <efgb4v$lg9$1@sea.gmane.org>
Pavel Usischev пишет:
> Nick S. Grechukh пишет:
>> линуксоид в кафе:
>>
>> cat menu | grep ^Кофе | awk '{print $2" "$1}' | sort -r -n | tail -n 5
>
> Какой ужас :)
>
> awk '/^Кофе/ {print $2" "$1}' menu | sort -r -n | tail -n 5
>
> На самом деле не ужас конечно, но неоднократно замечал, что в примерах
> используют на одну-две утилиты больше, чем легко можно было бы. Пожалуй,
> cat -- лидер по такому использованию.
>
Тому есть логичное объяснение:
если писать скрипт сразу зная, как он работает, и что обрабатывает, то
можно и без cat. А если собирать такую команду из кусочков по шагам, то
сначала cat и посмотреть, что там есть, потом awk print, чтоб вывести
нужные части, потом sort + tail.
--
Alexei V. Mezin
NT-MDT Co.
Phone: 095-913-5736
Fax: 095-913-573
Email: mezin@ntmdt.ru
URL: http://www.ntmdt.com
next prev parent reply other threads:[~2006-09-28 11:24 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-28 9:58 [room] " Kaydannik Alex
2006-09-28 10:07 ` Nick S. Grechukh
2006-09-28 10:09 ` Nick S. Grechukh
2006-09-28 10:20 ` Kaydannik Alex
2006-09-28 10:33 ` Nick S. Grechukh
2006-09-28 11:19 ` [room] [JT] " Pavel Usischev
2006-09-28 11:24 ` Alexei V. Mezin [this message]
2006-09-28 11:26 ` Nick S. Grechukh
2006-09-28 11:52 ` [room] " Andrew Borodin
2006-09-28 15:16 ` Andrey Rahmatullin
2006-09-29 5:06 ` Andrew Borodin
2006-09-29 23:04 ` Michael Shigorin
2006-09-28 15:13 ` A.Kitouwaykin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=451BB0D2.4020604@ntmdt.ru \
--to=mezin@ntmdt.ru \
--cc=smoke-room@lists.altlinux.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Культурный офтопик
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/smoke-room/0 smoke-room/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 smoke-room smoke-room/ http://lore.altlinux.org/smoke-room \
smoke-room@lists.altlinux.org smoke-room@lists.altlinux.ru smoke-room@lists.altlinux.com smoke-room@altlinux.ru smoke-room@altlinux.org smoke-room@altlinux.com
public-inbox-index smoke-room
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.smoke-room
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git