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 :: how to install moment in vuejs 
Shell :: change crontab editor 
Shell :: remove all branches deleted on remote 
Shell :: conda install pandas 
Shell :: Failed to bind to address http://localhost:5110 
Shell :: dotnet format install 
Shell :: push local branch upstream 
Shell :: applescript copy to clipboard 
Shell :: conda install pymodbus 
Shell :: how to install xdebug 
Shell :: change directory on WSL 
Shell :: how to remove a package from arch linux 
Shell :: check active ssh users in linux 
Shell :: bash for i in range 
Shell :: How to create or generate secret key for django 
Shell :: enter user root linux 
Shell :: grep exclude files 
Shell :: intellij for mac crack 
Shell :: openssl check certificate expiration 
Shell :: shell show number of files in each folder 
Shell :: setting docker as a non root user 
Shell :: revert git add 
Shell :: install mpg321 
Shell :: kubectl get namespaces 
Shell :: git how to see changes made by a commit 
Shell :: npm insall serve globally 
Shell :: Creating a directory or folder in linux 
Shell :: reconfigure gitlab 
Shell :: how to remove a software from linux 
Shell :: docker compose exec compose 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =