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

sharadchhetri

Tutorials On Linux, Unix & Open Source

  • Home
  • Linux Commands
  • Resources
    • Learn Linux
  • My WordPress plugins

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:

  • Twitter
  • Facebook
  • More
  • Print
  • Email
  • LinkedIn
  • Reddit
  • Tumblr
  • Pinterest
  • Pocket
  • Telegram
  • WhatsApp
  • Mastodon

Related posts:

  1. setfacl: Option -m: Invalid argument near character 3
  2. Convert new line to space by using sed command
  3. convert space into new line using sed command
  4. cat,sed and awk commands to display file contents
  5. sed : find the pattern (keyword) and delete the line from file
  6. remove html tags by using sed command
  7. sed command to display text between two strings or keywords
  8. Taking file backup while using sed command with -i flag
  9. How to print particular line number by using sed command
  10. sed : remove lines between two keywords [ including keywords ]

Filed Under: Linux, 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

Our Social Media Presence

  • Facebook
  • GitHub
  • Twitter

Linux Command

What is Linux Internal And External Command

Linux Basic Commands With Examples For Every Beginner

tr command to convert lines to space , tab and vertical tab

smbpasswd command not found on CentOS 7 and RHEL 7

Solution : semanage command not found

Unix / Linux : How to print duplicate lines from file

More Posts from this Category

You Might Like These Articles!

simplecodesyntax wordpress plugin

SimpleCodeSyntax : My Another WordPress Plugin

Install Nginx

How To Install Nginx On Ubuntu 22.04 LTS

Install Latest Git package in Ubuntu Operating System

How To Always Install Latest Git Package In Ubuntu Operating System

Bash script for installing VirtualBox on Ubuntu 22.04 LTS Desktop

Install VirtualBox On Ubuntu 22.04 LTS Desktop (Bash Script)

libfuse

dlopen(): error loading libfuse.so.2 – Got Error On Ubuntu

Failed to open/create the internal network

VirtualBox Error: Failed to open/create the internal network

Always Useful Tips And Tricks

How to protect from port scanning and smurf attack in Linux Server by iptables

df command not showing correct free space in linux

Print double hyphen sign simultaneously in post of Octopress

Error installing rails

How to backup and restore iptables on Linux systems

configure: error: C++ compiler cannot create executables

Learn Linux Date Command With Examples

Explore 90+ Article On "Linux Tips And Tricks"

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

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