Can someone help how to expedite the creation of a `CertificateSigningRequest` O . . .

Phani M:
Can someone help how to expedite the creation of a CertificateSigningRequest Object?
In the csr manifest file, under request the base64 encoded csr need to be given without having new line characters.
My typical flow of creation is like this:

  1. Get the CSR in base64 encoded by running the command: cat akshay.csr | base64
  2. Copy the encoded csr, vi the csr definition yaml file and paste under request section.
    But, doing this will insert the newline characters.
    To avoid it, after pasting in the vi editor, I use Shift+J by going to the end of the line, remove the space ā€¦. repeat till the last line.
    This takes a lot of time which I cannot afford doing it in the exam.

What is the easy & faster way to do it?
Assume the .csr file is available in the /root directory

Yanhua Li:
To get rid of the new line, use cat john.csr | base64 | tr -d ā€œ\nā€

Vijin Palazhi:
you can also try : base64 -w 0

Phani M:
Thank you @Yanhua Li, @Vijin Palazhi both works zippy