.Dd 2026-06-02 .de oit .It \\$* .. .de obi .Bl -\\$1 -compact .shift .oit \\$* .. .de obe .obi \\$* .El .. .de obd .Bd -literal -compact \\$* .. .de obc .Bl -column \\$* .. .Dt TEXT_PROCESSING oh .Nm text processing .Nd tools .Tg index .obc paste_ .It Li Xr sed oh Ta : text stream editor, commonly used for substitution. .It Li Xr cut oh Ta : split string. .It Li Xr tr oh Ta : translate characters. .It Li Xr paste oh Ta : join files/lines. .It Li Xr awk Ta : pattern processing language. .El .Sh sed .obc replace_the_second_occurre .It replace old with new Ta : Li s/old/new/ .It replace all occurrences Ta : Li s/old/new/g .It replace the second occurrence Ta : Li s/l/p/2 .El .Ss Examples .obd $ echo \&"hello\&" | sed \&"s/l/p/\&" heplo $ echo "hello" | sed "s/l/p/g" heppo $ echo "hello" | sed "s/l/p/2" helpo .Ed .Sh cut .obc _ .It -d Ta | delimeter .It -c Ta | split by character count .It -d Ta | split by character (specify delimeter) .It -f Ta | specify field count. Use n,-n,n- .D1 -f 2, gets 2nd field; -f -2, gets up to the 2nd field; -f 2-, gets from the 2nd field to the end .El .Bd -literal -compact $ echo "a b c" | cut -d " " -f 2 b $ echo "a b c" | cut -d " " -f 2- b c $ echo hello | cut -c 2 e .Ed .Sh tr .Bd -literal -compact $ echo "hello" | tr "l" "m" hemmo .Ed .Ss control chacters .obd echo \&"hello\&" | tr 'e' '\en' h llo .Ed .Ss .obd echo 'hello' | tr 'l' '\et' he o .Ed .Ss character range .obd echo 'hello' | tr 'h-l' 'a-d' aeddo .Ed .Ss Character classes .obd echo '1.hello\en2.goodbye' | tr '[:digit:]' 'a-c' b.hello c.goodbye .Ed .Sh paste Requires a file on OpenBSD, cat be a pipe redirection on Slackware. .Ss OpenBSD .Bd -literal -compact $ cat test.log 1 2 3 $ paste -s -d "+" test.log 1+2+3 .Ed .Ss Slackware .obd cat test.log | paste -s -d "+" 1+2+3 .Ed .Sh head .obc head_ get_first_10_line_of_file .It head Ta : Get first 10 lines of file Ta : Li head FILENAME .It head -15 Ta : Get first 15 lines of file Ta : Li head -15 FILENAME .El .Sh tail .obc tail_ get_last_10_lines_of_file_continuou_ .It tail Ta : Get last 10 lines of file Ta : Li tail FILENAME .It tail -15 Ta : Get last 15 lines of file Ta : Li tail -15 FILENAME .It tail -f Ta : Get latest lines of file continuously Ta : Li tail -f FILENAME .El .Sh grep .obc case_insensitive_search_for_patt .It Get lines matching pattern Ta : Li grep PATTERN FILE(S) .It Get lines not matching pattern Ta : Li grep -v PATTERN FILE(S) .It Get file names not matching pattern Ta : Li grep -L PATTERN FILE(S) .It Get line numbers matching pattern Ta : Li grep -n PATTERN FILE(S) .It Case-insensitive search for pattern Ta : Li grep -i PATTERN FILE(S) .It Recursive search Ta : Li grep -R PATTERN DIRECTORY .El .Sh TODO .obc .It - Translate to Spanish. .It - review and improve if needed. .El .Sh SEE ALSO .obc .It .Xr openbsd oh , .Xr slackware oh .It OpenBSD manpages: .Xr paste 1 , .Xr tr 1 , .Xr head 1 , .Xr tail 1 , .Xr grep 1 .El .Sh HISTORY .obc _______ .It 2026-06-02 Ta : Fixed name: text_manipulation > text_processing. .It 2025-10-03 Ta : Created .El .Sh AUTHORS .An -nosplit .Xr ohazot oh | .Xr about oh | .Lk https://ohazot.com ohazot.com .Aq Mt admin@ohazot.com