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\', wha
awk
version is probably the best way to go, but you can also use cut
if you firstly squeeze the repeats with tr
:
ps axu | grep jbos[s] | tr -s ' ' | cut -d' ' -f5
# ^^^^^^^^^^^^ ^^^^^^^^^ ^^^^^^^^^^^^^
# | | |
# | | get 5th field
# | |
# | squeeze spaces
# |
# avoid grep itself to appear in the list