Skip to main content

Linux command: tr - translate or delete characters

tr - translate or delete characters

-s : squeeze
-d : delete
-t : translate

Example file: files.txt

$ file files.txt
files.txt: ASCII text, with CRLF line terminators
$ cat file
8V2L
bny0
c4ZX
D8B3
FHl1
oiMO
PFbD
rmfX
SRSq
uqyw
v2Vb
X1Uy

Combine lines

$ tr -s '\r\n' ' ' < files.txt
8V2L bny0 c4ZX D8B3 FHl1 oiMO PFbD rmfX SRSq uqyw v2Vb X1Uy $

Delete new line characters

$ tr -d '\n' < inputfile.txt > outputfile.txt

Practice

>>> THM | Linux Modules - Task 5

Popular posts from this blog

Microsoft Windows 10 1903

Check for new feature at What's new in Windows 10, version 1903 IT Pro content

Data Recovery Softwares

Follow 3-2-1 backup rule so you do not need these data recovery softwares.

Linux command: printenv

printenv - print all or part of environment NAME        printenv - print all or part of environment SYNOPSIS        printenv [OPTION]... [VARIABLE]... DESCRIPTION        Print  the  values  of the specified environment VARIABLE(s).  If no VARIABLE is speci‐        fied, print name and value pairs for them all.        -0, --null               end each output line with NUL, not newline        --help display this help and exit        --version               output version information and exit        NOTE: your shell may have its own version of printenv,  which  usually  supersedes  the        version  described  here.  Please refer to your shell's documentation for d...