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 AI Shell: Notes

AI Shell

Windows 10: Install SuSE Linux Enterprise - SLES

With Microsoft-Windows-Subsystem-Linux feature enabled, we can install Linux distributions on Windows 10.

[MicrosoftVisualStudio]: Microsoft Visual Studio shortcut keys

Source:  http://visualstudioshortcuts.com/2015/ Analyze Navigate Backward Shift+Alt+3 Navigate Forward Shift+Alt+4 Architecture New Code Map Ctrl+\, Ctrl+O New UMLor Layer Diagram Ctrl+\, Ctrl+N Architecture Context Menus Add Node Ins Both Dependencies B Incoming Dependencies I Outgoing Dependencies O New Comment Ctrl+Shift+K Ctrl+E, C Remove Del Rename F2 Build Build Solution Ctrl+Shift+B Cancel Ctrl+Break Compile Ctrl+F7 Run Code Analysison Solution Alt+F11 Class Diagram Collapse Num - Expand Num + Class View Context Menus Properties Alt+Enter Misc Commit All Edits Shift+Alt+U Move Left Edgetotheleft Ctrl+Shift+, Move Left Edgetotheright Ctrl+Shift+. Move Right Edgetotheleft Ctrl+Shift+Alt+, Move Right Edgetotheright Ctrl+Shift+Alt+. TSql Editor Clone Query Ctrl+Alt+N TSql Editor Database Combo Shift+Alt+PgDn View File In Script Panel Shift+Alt+PgDn Debug Apply Code Changes Alt+F10 Attachto Process C...