0

I have a text file : ABC.txt which contain below data

A Apple a day keeps a doctor away 
B I like to play with Ball
C I have cat at my home
D My Dog name is bob

I want to display output on my screen with 10 spaces in a frontend and then my file data

Expected output :

      A Apple a day keeps a doctor away 
      B I like to play with Ball
      C I have cat at my home
      D My Dog name is bob

I have tried this but not working

Command :

cat ABC.txt  | column -t 
cafopa2172
  • 133
  • 6

1 Answers1

0
prefix='          '
sed "s/^/$prefix/" ABC.txt 

^ matches the beginning of the line, and this replaces it with 10 spaces.

If the number of spaces can vary, you can calculate the prefix variable instead of hard-coding it. See How can I repeat a character in Bash?

Barmar
  • 741,623
  • 53
  • 500
  • 612