Fresh command shell:cut

Just added the command 'shell:cut' to allow splitting of lines. The command is more flexible as the original shell command and allows spliting by regular expressions.
This is the option list:
  • -r Replace regex
  • -e Regular expression
  • -d Seperate parts by this regex
  • -t Trim every single part
  • -f Fields expression
  • -j Glue between fields
  • -p Positions
Field expressions are a comma separated list of fields or field ranges. The first field is zero '0'.
Examples:
bundle:list|cut -d \\\| -t -j ' ' -f 1,3,2
Active 80 0.0.0
...
bundle:list|cut -d \\\| -t -j ' ' -f 1-,0
Active 80 1.4 Commons DBCP 71
...
bundle:list|cut -d \\\| -t -j ' ' -f 1,abc,2
Active abc 80
...
The option -p followed by a list of ranges in the line.
Examples:
bundle:list|cut -j '&' -p 10-20,1-10,abc
ve |  80 |&69 | Acti&abc
...
Every positions definition can't be out of boundls. In the worst case it will be ignored. An empty line - without written fields - will be ignored.
The options -e and -r must be defined together and change the line content before processing the split mechanism.

Comments

Popular posts from this blog

Prepare karaf shell settings to work with mhu-osgi-tools

Test your available CPU resources in karaf

Highlight outputs in karaf gogo shell