Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

How to convert spaces into tabs?

Answer:

You can use the unexpand command

# unexpand  test.txt 

Another example:

#  echo -e "        A" | unexpand | sed 's/\t/F/g'
FA
  1. Delete trailing spaces or tabs from end of each line
  2. How to convert tab into spaces?
  3. Convert spaces into new lines using sed
  4. How to expand tab into spaces in vi / vim
  5. Convert Windows text file to UNIX format without dos2unix

Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>