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
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
Delete leading whitespace (spaces/tabs/etc) from beginning of each line
ruby -pe 'gsub(/^\s+/, "")' < file.txt
Remove empty characters at the end of each row
sed -e 's/ *$//' file.txt