Been a long while since I've been here and the changes look great.
Have a simple task that has been raised due to meeting PCI AND ISO standards. We currently keep a copy of all FTP/SFTP batch scripts just in case we need to view them, they are overwritten with each run, but we still keep them.
These files as a result contain UID's & PWD's. Meeting with the standards, I'd like to include a simple sed or awk statement that replaces each line of the said batch scripts beginning with 'user' to 'user **** ****'. Replacing the UID & PWD.
This would occur immediately after the batch script is used and satisfy our requirement.
Which is easier to use to acomplish this -- sed or awk ??
Many thanks SanjayLinux, Klashxx & ghostdog74 for your replies.
Sanjay - too true - I used to remember using sed many years ago. Just been too long now. :o
Klashxx - thanks for the perl example, though my requirement isn't a case of plain substitution; rather replacement of the entire line.
ghostdog74 - yep a while has past since I first joined the forum. Was surprised I could even remember my UID & PWD for the site. Unfortunately because of my involvement in PCI and ISO work, I've not had much opportunity for sometime or a reason to use sed, let alone look at awk.
I was able to perform what I wanted to do via the command line, but would like to know how can I contain the following to a single-line command statement ??
$ sed '
> /^user/ c\
> user **** ****
> ' temp.txt
INPUT FILE:
user UID1 PWD1
user UID2 PWD2
user UID3 PWD3
get blah-blah-blah
close
bye
OUTPUT:
user **** ****
user **** ****
user **** ****
get blah
close
bye
Thanks in advance if you are able to assist with my query.