The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Search, replace string in file1 with string from (lookup table) file2? gstuart Shell Programming and Scripting 9 06-08-2009 07:11 AM
Clueless about how to lookup and reverse lookup IP addresses under a file!!.pls help choco4202002 UNIX for Advanced & Expert Users 0 08-26-2008 02:28 PM
search and replace coolkid Shell Programming and Scripting 3 08-12-2008 06:15 PM
Perl: Search for string on line then search and replace text Crypto Shell Programming and Scripting 4 01-04-2008 10:24 AM
search and replace dannyd UNIX for Dummies Questions & Answers 18 04-17-2007 08:42 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 10-06-2008
deepakgang deepakgang is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 38
Unhappy Script to : Search and replace

Hi Chaps,

I have a file which is like below:

>cat file.dat

FIRSTP SECONDP PATH="c:\ftp\dir\test.dat" USER=user1 PASS=*PASSWORD*
Sub1=Dir
Sub2=Test
>

I need to do the below:

1. Take each line, check if the line contains the word *PASSWORD*
2. If so check the USER (in this case user1) and lookup in another file pass.dat for the password
3. Replace the *PASSWORD* with the actual password (replace the stars as well)
4. The output file should contain the same lines as input file in the same order with just the password updated

Please could you help?

One of the main problems i find is the "c:\ftp" - somehow the \f is taking it as next line and im unable to manipulate that.

Thanks in advance,
D

Last edited by deepakgang; 10-06-2008 at 11:44 AM..
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:37 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0