Multiple choice technology operating systems

Command used to replace all space with | and create another output file

  1. cat test1 | tr ' ' '|' > test2

  2. cat test1 | cut-d ' ' ' |' > test2

  3. cat test1 | tr '|' ' ' > test2

  4. cat test1

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The 'tr' command translates characters. Using 'cat test1 | tr ' ' '|' > test2' reads the file, translates all spaces to pipe characters, and redirects output to test2. Option B uses 'cut' incorrectly for this purpose, option C translates pipes to spaces (reverse of what's asked), and option D doesn't perform any transformation.