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

Java: Free Online Courses

The Java™ Tutorials by Oracle The Java Tutorials are practical guides for programmers who want to use the Java programming language to create applications. They include hundreds of complete, working examples, and dozens of lessons. Groups of related lessons are organized into "trails". https://docs.oracle.com/javase/tutorial/ Learn to Program in Java at edX.ogr Get started on the path to becoming a software engineer by learning core coding skills in Java—one of the most popular programming languages. https://www.edx.org/course/learn-to-program-in-java-0 Java Tutorial by javapoint.com https://www.javatpoint.com/java-tutorial Java Tutorial by SoloLearn.com I love SoloLearn because I can learn Java - and other popular programming languages - anywhere, any time on your mobile devices. https://www.sololearn.com/Course/Java/ Java on Azure https://docs.microsoft.com/en-us/learn/paths/java-on-azure/

Less secure app access in gmail or G Suite

From G Suite Update on December 16, 2019 Google turned off less secure app access to G Suite accounts .