Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Software
User Name
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.


  Search this Thread
Old 03-17-2015, 11:45 PM   #1
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

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
Registered: Jun 2012
Distribution: Slackware
Posts: 441

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

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

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

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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:40 PM.

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