On Fri, 11 Sep 2009, Thomas Dickey wrote:

On Fri, 11 Sep 2009, Javier Barroso wrote:

On Thu, Sep 10, 2009 at 11:33 PM, Cameron Hutchison <li...@xdna.net> wrote:
/proc/pid/cmdline usually has ASCII NUL separated fields, which awk does
not split, so usually you have to use xargs -0. I noticed some cases
where the args were space separated (perl script), so I needed awk for
that case. I'll look more into awk and see if it can handle NULs in
some way. It doesn't by default.
Ok, I didn't know that. Thank you for the explication

awk -F '\000' '{print $1;exit}' /proc/$pid/cmdline

That depends on whether you're using gawk (which provides a non-POSIX
extension for nulls), or mawk.

fwiw, this example works with current mawk - here:

        http://invisible-island.net/mawk/

however, Debian's packagage maintainer for mawk has not responded to any of the fixes which I've made over the past year.

--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net


--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to