[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

shell problem.

Posted on 2001-09-11
3
Medium Priority
?
244 Views
Last Modified: 2013-12-27
my file is having an entry like this


hello how are u msnr


using shell script i want to replace msnr with user2

how can i do this.?
same way how can i modify multiple lines.

thans
0
Comment
Question by:msnr
[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
  • 2
3 Comments
 
LVL 40

Expert Comment

by:jlevie
ID: 6474322
That's not too difficult. Use 'cat my-file | sed -e "s/msnr/usr2" >my-file' to change the files in place or 'sed -e "s/msnr/usr2/" <in-file >out-file" to retain the original files.
0
 
LVL 1

Author Comment

by:msnr
ID: 6474557
i want to append to the line as

hello how are u msnr:usr2

can i.?

msnr
0
 
LVL 40

Accepted Solution

by:
jlevie earned 100 total points
ID: 6475086
Sure the sed command I used above silmply replaces 'mnsr' with 'user2. If you want to replace it with 'msnr:usr2' use 'sed -e "s/mnsr/mnsr:usr2/ <in-file >out-file'.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
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…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses

649 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