Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

bash strip preceeding white space

# Basic syntax:
sed 's/^ *//g'

# Example usage:
echo '                    text' # Printing without sed command
-->                     text
echo '                    text' | sed 's/^ *//g' # Pipe to sed command
--> text

# Note, use the following to remove all whitespace from the end of every line
sed 's/ *$//g'
Comment

remove white space from stering in bash

$ var='abc def'
$ echo "$var"
abc def
# Note: flussence's original expression was "${var/ /}", which only replaced the *first* space char., wherever it appeared.
$ echo -n "${var//[[:space:]]/}"
abcdef
Comment

PREVIOUS NEXT
Code Example
Shell :: Usage: yarn [options] yarn: error: no such option: --template 
Shell :: uninstall genymotion from ubuntu 
Shell :: Git commit ignore pre-commit hooks 
Shell :: sha256 windows 10 
Shell :: how to find the ~/.zshrc file 
Shell :: installer laravel avec docker 
Shell :: is linux bad 
Shell :: conda install neptune ai 
Shell :: install mysql linux mint 
Shell :: how to view a list of installed npm packages 
Shell :: how to install mongodb on ubuntu 22.04 
Shell :: delete local comits 
Shell :: homebrew install git 
Shell :: how to clean up all docker containers 
Shell :: install pygame on mac 
Shell :: git update submodule recursive 
Shell :: how to undo git remote origin 
Shell :: install rpm ubuntu 
Shell :: git set upstream 
Shell :: git rename commit message 
Shell :: eval minikube docker-env daemon 
Shell :: add dns in ubuntu permanently 
Shell :: for i in range bash 
Shell :: shell for file in directory 
Shell :: install xelatex ubuntu 
Shell :: powershell open device manager 
Shell :: install insomnia mac brew 
Shell :: How to run batch file and dellete it 
Shell :: how to remove sudo permission in from download 
Shell :: unzip command in ubuntu 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =