Skip to primary content
Skip to secondary content

Incredigeek

Incredigeek

Main menu

  • Home
  • Linux
  • Windows
  • OS X
  • Projects
    • UBNTMOD
    • Email Tracker
    • IP Watt Meter
    • Grond : LUKS Password Cracker

Tag Archives: tr

Remove spaces in string in bash variable

Posted on October 10, 2019 by admin
Reply

There are multiple way to remove spaces,

# Variable a contains the following
a="Hello World !"

echo

echo ${a// /}

Sed

echo $a | sed "s/\ //g"

tr

tr -d ' ' <<<"$a"

or

echo $a | tr -d ' ' 

Returned output

HelloWorld!
Posted in Linux | Tagged bash, echo, spaces, tr | Leave a reply

Recent Posts

  • Enable Automatic Update for Ubuntu 20.04
  • Limit Network Speed of wget
  • Installing Discord on Fedora 33
  • OLED Screen Brightness on Fedora 33
  • no permissions (user in plugdev group; are your udev rules wrong?)
  • Show Down Devices From SSH – LibreNMS
  • Migrate LibreNMS to new Server
  • How to Restore Pixel to Factory Image
  • Unable to Remove Authorized SSH Keys from AirOS
  • How To Setup Samba/CIFS Share on Fedora Server

Tags

  • android
  • apple
  • Backup
  • bash
  • centos
  • command line
  • cpanel
  • debian
  • email
  • fedora
  • firewall
  • install
  • ip
  • librenms
  • linux
  • Mac
  • microsoft
  • mikrotik
  • monitoring
  • mysql
  • networking
  • nms
  • OS X
  • password
  • pi
  • programming
  • Raspberry pi
  • routeros
  • script
  • snmp
  • ssh
  • ubiquiti
  • ubnt
  • ubuntu
  • unifi
  • unifi-video
  • unity
  • unity3d
  • vm
  • whm
  • Windows
  • windows 10
  • XenServer
  • zenoss
  • zenoss 5

Recent Posts

  • Enable Automatic Update for Ubuntu 20.04
  • Limit Network Speed of wget
  • Installing Discord on Fedora 33
  • OLED Screen Brightness on Fedora 33
  • no permissions (user in plugdev group; are your udev rules wrong?)

Categories

  • Alienware
  • Android
  • Apple
  • Arduino
  • Baicells
  • Cable
  • Cambium
  • CentOS
  • Command Line
  • Computer Mods
  • cPanel
  • Cron
  • Crypto Currency
  • Debian
  • Dell
  • DNS
  • DNS
  • Drones
  • Email
  • Fedora
  • FreeBSD
  • Freeradius
  • GrapheneOS
  • Hacking
  • Hackintosh
  • Information
  • Inkscape
  • Internet
  • LibreNMS
  • LineageOS
  • Linux
  • MacOS
  • Mikrotik
  • Minecraft
  • Mining
  • MySQL
  • Nagios
  • Networking
  • Networking
  • Office
  • OS X
  • Programming
  • PSU
  • Python
  • Random
  • Raspberry Pi
  • RedHat
  • Reset Passwords
  • Scripts
  • Security
  • Slackware
  • SNMP
  • Tear Downs
  • Ubiquiti
  • Ubiquiti Command Line
  • Ubuntu
  • Uncategorized
  • UniFi
  • UniFi Video
  • Unity3D
  • VIM
  • Virtualization
  • Visual Studio
  • VMware
  • Web
  • Web Browser
  • Windows
  • Windows 10
  • Windows 8
  • Wireless
  • Wireshark
  • WISP
  • WordPress
  • XenServer
  • Zenoss
Proudly powered by WordPress