LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-17-2015, 11:45 PM   #1
prasad1990
LQ Newbie
 
Registered: Feb 2015
Posts: 11

Rep: Reputation: Disabled
Smile How to show selected string using grep from file and replace it with new input string


Hello Friends,

I want to print string with its value from file and and again replace with new value, example below:-

cat > abc.txt
Default_user=d13703,password=az*12345

I want show "password=az*12345" and replace with "new password=az*45678".

please suggest me what to do?
 
Old 03-18-2015, 12:29 AM   #2
Philip Lacroix
Member
 
Registered: Jun 2012
Distribution: Slackware
Posts: 441

Rep: Reputation: 574Reputation: 574Reputation: 574Reputation: 574Reputation: 574Reputation: 574
Quote:
I want show "password=az*12345"
Pipe cat (or grep) through cut and use comma as field delimiter (man cut).

Quote:
and replace with "new password=az*45678".
You can do that with GNU sed.

Philip
 
1 members found this post helpful.
Old 03-19-2015, 08:02 AM   #3
prasad1990
LQ Newbie
 
Registered: Feb 2015
Posts: 11

Original Poster
Rep: Reputation: Disabled
Thanks friend it helpful for me...
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
using grep and sed to find and replace a string with a pattern (HELP) bengerman Linux - Newbie 5 07-03-2013 12:53 PM
[SOLVED] Issue trying to grep a string, but keep a similar string Supp0rtLinux Linux - Software 7 10-04-2011 06:35 PM
replace string by another string in bash shell chinhth2010 Linux - General 2 08-02-2011 10:40 PM
[SOLVED] replace string with empty string of dir path ted_chou12 Linux - Newbie 3 04-02-2011 06:43 AM
how do i replace a text string in a file with a random string? (with sed etc) steve51184 Linux - Software 16 09-02-2010 11:05 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:51 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration