VARIOUS ED(1) COMMANDS WIP: Expanding page to include other CLI tools Text manipulation ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Line splitting ---------------------------------------------------------------------- Split a line using a substitution and multi-line power combo! First, pack your substitution command's patterning matching part with the pattern where you want your new, split line to begin. Then, hang a back slash off the substitution command's replacement text part. Knock that enter key on your 'board to get a new line. Throw down an ampersand to grab that matched patt. Finally end the replacement with a forward slash. And if you're feeling fancy, add a quick p on your way to hitting Return. ,---- | ,pn | 1 this line should split at the first word 'split' | s/split/\ | &/p | split at the first word 'split' | ,pn | 1 this line should | 2 split at the first word 'split' `---- A small variation is to put the ampersand before the backslash. That'll make the split begin right after the matched pattern. Finding out stuff about files ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ See number of lines in files in a directory: `find src/* -type f -exec wc -l '{}' \;'