Txt

Byte sized tech know-how.

  • Home
  • About

Tag Archives: whitespace

12 May

Delete Leading Whitespace Using Sed

Delete leading whitespace (spaces/tabs/etc) from beginning of each line. Same as yesterday’s command – but using sed


cat file.txt | sed -e 's,^ *,,'

Credit: Vivin

admin Posted in Command Line, Linux command, delete, leading, Linux, sed, whitespace Leave a comment
11 May

Delete Leading Whitespace

Delete leading whitespace (spaces/tabs/etc) from beginning of each line


ruby -pe 'gsub(/^\s+/, "")' < file.txt
admin Posted in Command Line, Linux, Ruby command, delete, filler, line, Linux, whitespace 1 Comment
18 Apr

Remove Empty Characters at End of Lines

Remove empty characters at the end of each row


sed -e 's/ *$//' file.txt
admin Posted in Command Line, Linux end, line, remove, sed, whitespace Leave a comment

Post navigation

Categories

  • Code
  • Command Line
  • Configuration
  • CSS
  • HTML
  • internet
  • JavaScript
  • Linux
  • Mobile
  • Perl
  • PHP
  • Python
  • Ruby
  • Uncategorized

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
Fruitful theme by fruitfulcode Powered by: WordPress
↑