wc command.pbpaste | wc -m
pbpaste: Outputs clipboard data as standard. If it is text, the text is output. If you copy the file in Finder, the file name will be output.wc -m: Counts the number of characters. It also supports multi-byte characters with the -m option.pbpaste as the input of wc -m and finally output the result of wc -m.Add the -l option.
pbpaste | wc -ml
Two numbers are now output, the first corresponds to the number of lines and the second corresponds to the number of characters.
Delete the newline character with the tr command.
pbpaste | tr -d '\n' | wc -m
Use the tr command to remove whitespace and newline characters.
pbpaste | tr -d '\n' | tr -d ' ' | wc -m
Put the nkf command in between with the appropriate options.
ISO-2022-JP
pbpaste | nkf -j | wc -m
Shift_JIS
pbpaste | nkf -s | wc -m
EUC-JP
pbpaste | nkf -e | wc -m
UTF-16
pbpaste | nkf -w16 | wc -m
Recommended Posts