Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

how to remove every space in a string in bash

#!/bin/bash

#Make our variable
var="foo bar"

#Print it without the spaces
echo ${var//[[:blank:]]/}

#Output will be foobar
Comment

bash remove trailing whitespace from every line

# Basic syntax:
awk '{$1=$1};1' your_file
Comment

PREVIOUS NEXT
Code Example
Shell :: linux get current user 
Shell :: centos show hdd 
Shell :: bash write 
Shell :: git checkout branch on different remote 
Shell :: cache your login credentials in git command 
Shell :: windows kill process on port 
Shell :: npm ignore scripts 
Shell :: ubuntu terminal find file recursive 
Shell :: ubuntu upgrade 
Shell :: yarn 2 outdated packages 
Shell :: docker compose run 
Shell :: get string after character shell script 
Shell :: push clone repo to own repo 
Shell :: create ubuntu 20.04 with azure cli 
Shell :: git command create new branch from current and move changes 
Shell :: wasm pack install 
Shell :: bash loop lines in file 
Shell :: check how many version installed on nvm package 
Shell :: android mobile screen share in ubunut 
Shell :: bash how to pass shell variables to awk 
Shell :: install httrack on ubuntu 20.04 
Shell :: how to debug wirelessly android 
Shell :: replace first occurence of substring 
Shell :: git pull from another user 
Shell :: zsh to bash mac 
Shell :: docker view container logs 
Shell :: brew status service 
Shell :: commit to a new branch 
Shell :: screen recorder for ubuntu 
Shell :: ubuntu set current timezone asia/kolkata 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =