Solved

use of sed to replace a line in a file

Posted on 2013-05-31
3
561 Views
Last Modified: 2013-05-31
Im trying to run this string to update a file using sed but I'm getting an error, any help is appreciated.

sed -i 's/^user:$2a$10$xDaSTFrgvbBLei/sKK3sWeVVwJBUGTJjEn/AxrTCrdlZhm4aLVsI2:15854::::::/user:$2a$10$oQXSUBcZBognRNghQ63GBexOg8sX1gZuks06xRRO9BXdWQrZinI3u:15856::::::/' /etc/shadow

error returned is
sed: -e expression #1, char 51: unknown option to `s'

Regards,
0
Comment
Question by:atorex
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 3

Assisted Solution

by:PtitPinpin
PtitPinpin earned 250 total points
ID: 39211190
Hi,

i think you should take care of / and $ in your password hash...
sed -i 's/^user:\$2a\$10\$xDaSTFrgvbBLei\/sKK3sWeVVwJBUGTJjEn\/AxrTCrdlZhm4aLVsI2:15854::::::/user:\$2a\$10\$oQXSUBcZBognRNghQ63GBexOg8sX1gZuks06xRRO9BXdWQrZinI3u:15856::::::/' /etc/shadow

Regards
0
 
LVL 84

Accepted Solution

by:
ozo earned 250 total points
ID: 39211322
sed -i 's#^user:$2a$10$xDaSTFrgvbBLei/sKK3sWeVVwJBUGTJjEn/AxrTCrdlZhm4aLVsI2:15854::::::#user:$2a$10$oQXSUBcZBognRNghQ63GBexOg8sX1gZuks06xRRO9BXdWQrZinI3u:15856::::::/# /etc/shadow
0
 

Author Closing Comment

by:atorex
ID: 39211402
thanks
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Suggested Courses

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question