From: Alexander Kapshuk <alexander.kapshuk@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: gregkh@linuxfoundation.org, jim.epost@gmail.com, richard@nod.at,
tytso@mit.edu, Alexander Kapshuk <alexander.kapshuk@gmail.com>
Subject: [PATCH 22/22] ver_linux: proc/modules, limit text processing to 'sed'
Date: Mon, 12 Oct 2015 21:40:02 +0300 [thread overview]
Message-ID: <1444675202-1375-22-git-send-email-alexander.kapshuk@gmail.com> (raw)
In-Reply-To: <1444675202-1375-1-git-send-email-alexander.kapshuk@gmail.com>
This patch is more of a personal preference, rather than a fix for a problem.
The current implementation used a combination of both 'cat' and 'sed'
to generate an unsorted list of kernel modules separated by while space.
The proposed implementation uses 'sort' and 'sed' to generate a sort
list of kernel modules separated by while space.
Tested on:
Gentoo Linux
Debian 6.0.10
Oracle Linux Server release 7.1
Arch Linux
openSuSE 13.2
Signed-off-by: Alexander Kapshuk <alexander.kapshuk@gmail.com>
---
scripts/ver_linux | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/scripts/ver_linux b/scripts/ver_linux
index ae426c2..024a11a 100755
--- a/scripts/ver_linux
+++ b/scripts/ver_linux
@@ -178,7 +178,16 @@ awk '/version/{
substr($0,RSTART,RLENGTH))
}'
-if [ -e /proc/modules ]; then
- X=`cat /proc/modules | sed -e "s/ .*$//"`
- echo "Modules Loaded "$X
-fi
+test -e /proc/modules &&
+sort /proc/modules |
+sed '
+ s/ .*//
+ H
+${
+ g
+ s/^\n/Modules Loaded\t\t/
+ y/\n/ /
+ q
+}
+ d
+'
--
2.4.9
next prev parent reply other threads:[~2015-10-12 18:41 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-12 18:39 [PATCH 01/22] ver_linux: gcc -dumpversion, use regex to find version number Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 02/22] ver_linux: make --version, " Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 03/22] ver_linux: binutils, fix inaccurate output Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 04/22] ver_linux: util-linux, 'fdformat' not ubiquitous any longer Alexander Kapshuk
2015-10-12 22:04 ` Jim Davis
2015-10-12 18:39 ` [PATCH 05/22] ver_linux: module-init-tools, look for numerical input, not field number Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 06/22] ver_linux: e2fsprogs, " Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 07/22] ver_linux: jfsutils, " Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 08/22] ver_linux: reiserfsprogs, " Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 09/22] ver_linux: xfsprogs, " Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 10/22] ver_linux: pcmciautils, " Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 11/22] ver_linux: quota-tools, " Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 12/22] ver_linux: ppp, " Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 13/22] ver_linux: libc, input redirection to sed fails in some distros Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 14/22] ver_linux: ldd, look for numerical input, not field number Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 15/22] ver_linux: libcpp, fix missing output Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 16/22] ver_linux: procps, look for numerical input, not field number Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 17/22] ver_linux: net-tools, " Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 18/22] ver_linux: loadkeys, " Alexander Kapshuk
2015-10-12 18:39 ` [PATCH 19/22] ver_linux: sh-utils, " Alexander Kapshuk
2015-10-12 18:40 ` [PATCH 20/22] ver_linux: use 'udevadm', instead of 'udevinfo' Alexander Kapshuk
2015-10-12 18:40 ` [PATCH 21/22] ver_linux: wireless-tools, look for numerical input, not field number Alexander Kapshuk
2015-10-12 18:40 ` Alexander Kapshuk [this message]
2015-10-12 20:22 ` [PATCH 22/22] ver_linux: proc/modules, limit text processing to 'sed' Jim Davis
2015-10-13 17:33 ` Alexander Kapshuk
2015-10-13 23:21 ` [PATCH 01/22] ver_linux: gcc -dumpversion, use regex to find version number Jim Davis
2015-10-14 9:29 ` Alexander Kapshuk
2015-10-14 21:43 ` Jim Davis
2015-12-02 14:24 ` Pavel Machek
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=1444675202-1375-22-git-send-email-alexander.kapshuk@gmail.com \
--to=alexander.kapshuk@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jim.epost@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=richard@nod.at \
--cc=tytso@mit.edu \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome