Try vim-way: $ ex -s +'%!cut -c 1-10' -cxa file.txt This will edit the file in-place (so do the backup first).