Solved

use of sed to replace a line in a file

Posted on 2013-05-31
3
530 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
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Utilizing an array to gracefully append to a list of EmailAddresses
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now