Skip to the content.

chars

run at Mon Jan  2 21:27:33 CET 2023
run on macOS 13.0.1 arm64 Darwin
benchmark v0.6.7
LANG = en_US.UTF-8

cut the first 20 characters of each line: using awk

Command: 'awk {print substr($0,1,20)}'
Before: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit'
After : 'Lorem ipsum dolor si'

cut the first 20 characters of each line: using cut

Command: 'cut -c1-20'
Before: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit'
After : 'Lorem ipsum dolor si'

cut the first 20 characters of each line: using gcut

Command: 'gcut -c1-20'
Before: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit'
After : 'Lorem ipsum dolor si'

cut the first 20 characters of each line: using ${line:0:20}

Command: '${line:0:20}'
Before: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit'
After : 'Lorem ipsum dolor si' (LANG = en_US.UTF-8)