• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
sharadchhetri

sharadchhetri

AI, Linux, Cloud and DevOps

  • Home
  • Resources
    • Learn Linux
    • Articles
  • My Projects & Work
    • My Nagios Plugin
    • My Dockerhub Repo
    • My WordPress plugins
    • My Github Repos
  • Facebook Page
  • Contact
  • Privacy Policy
  • About Me
You are here: Home / Articles / sed: -e expression #1, char 24: Invalid range end

sed: -e expression #1, char 24: Invalid range end

January 2, 2011 by Sharad Chhetri Leave a Comment

While working on sed command stricken with this, error : “sed: -e expression #1, char 24: Invalid range end “). To solve this problem, we have used sed and tr command.

We made a bash script having expect command in it. We were passing variable value from my mysql database into the bash script.

The output which was coming from mysql was appearing like this —
sed expression error

The problem was coming because the sed command which we used was giving right output i.e 351 only in terminal.
But in my bash script variable it seems it was also taking some other unknown characters or spaces.

Here the plus(+) sign is a special character.

The solution come when we used the below tr command in our bash script. It has trimmed the special character from the output which we got from mysql command.

ID=`mysql -uUsername -pPASSWORDXXX -e "select id from databasename.tablename where name = ''linuxtribe"| sed -e 's/[!@#$%^&*()]//g'|sed '1d'|tr -cds "[:alnum:]" "[ ]"`

The troubleshooting which we did ,is not same with every such error.

Share this:

  • Share on X (Opens in new window) X
  • Share on Facebook (Opens in new window) Facebook
  • More
  • Print (Opens in new window) Print
  • Email a link to a friend (Opens in new window) Email
  • Share on LinkedIn (Opens in new window) LinkedIn
  • Share on Reddit (Opens in new window) Reddit
  • Share on Tumblr (Opens in new window) Tumblr
  • Share on Pinterest (Opens in new window) Pinterest
  • Share on Telegram (Opens in new window) Telegram
  • Share on WhatsApp (Opens in new window) WhatsApp
  • Share on Mastodon (Opens in new window) Mastodon

Articles

How to install MySQL Server 5.6 on CentOS 7 / RHEL 7
How to install MySQL Server 5.7 on Ubuntu 14.04 LTS
How to change mysql default data directory in Ubuntu
Bash Code Injection Vulnerability via Specially Crafted Environment Variables
Taking file backup while using sed command with -i flag
Setup MySQL master slave replication in CentOS 6
sed : find the pattern (keyword) and delete the line from file
How to configure vsftpd server with virtual user mysql authentication in CentOS 6
print new line character in Unix / Linux
How to install mysql server 5.6 on Ubuntu 14.04 LTS ( Trusty Tahr )
Change path of tmpdir in MySQL Server On Ubuntu
How to print particular line number by using sed command
How to configure multiple mysql instance in Ubuntu
How to upgrade Mariadb 5.5 to Mariadb 10.0 on CentOS 7 / RHEL 7
Install VirtualBox On Ubuntu 22.04 LTS Desktop (Bash Script)

Filed Under: Articles, Tips And Tricks Tagged With: sed

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Articles

  • Install n8n docker in Ubuntu for practicing
  • Bash Script: MySQL Database backup to AWS S3
  • Automate no touch Jenkins setup wizard on docker (jcac)
  • How to run and configure Jenkins in Docker container
  • Complete Guide: How to install Nagios Monitoring on AlmaLinux / Rocky Linux
  • Install KVM on Ubuntu 24.04 LTS ( Bash Script )
  • How to install GIMP 2.10 on Ubuntu / Debian
  • 5 ways to check Ubuntu version of system (commands and GUI)
  • How To Solve Forgot MySQL / MariaDB Root Password
  • Create Self Hosted Build Agent Docker Image for Azure DevOps

Copyright © 2026 ยท
The material in this site cannot be republished either online or offline, without our permission.
Proudly Blogging From India.

  • Contact
  • About Me
  • My WordPress plugins
  • Privacy Policy