Is there any way to specify a field delimiter for more spaces with the cut command? (like " "+) ? For example: In the following string, I like to reach value '3744', what field delimiter I should say?
$ps axu | grep jboss
jboss 2574 0.0 0.0 3744 1092 ? S Aug17 0:00 /bin/sh /usr/java/jboss/bin/run.sh -c example.com -b 0.0.0.0
cut -d' '
is not what I want, for it's only for one single space.
awk
is not what I am looking for either, but how to do with 'cut'?
thanks.
tr
as shown here: stackoverflow.com/a/4483833/168143ps
+grep
you could usepgrep
which is available in most modern distros. It will return the result exactly in the form you need it.hck
as a drop incut
replacement. By default it splits on all whitespace, like awk. And the key feature is that you can specify a delimiter with-d
like cut, but unlike cut that delimiter can be a regex! No more needing to pre-process withtr -s
before passing to cut. You can findhck
here: github.com/sstadick/hck