Help with awk script (syntax error in regular expression)
I've found this script which seems very promising to solve my issue:
To search and replace many different database passwords in many different (.php, .pl, .cgi, etc.) files across my filesystem.
The passwords may or may not be contained within quotes, single quotes, etc.
My passwords.csv file contains old passwords and new ones, comma delimited. I've altered the find command within this script to find the files I want.
The script works if the first column (old password) has no special characters, but since these are passwords, there are lots of special characters.
It seems the second column (new password) can contain special characters ...
I've tested this by having the find command (within the script) find a specific file, with a password that has no special characters, and using a test passwords.csv with the non-special password (in the first column), and the new password (in the second column) having special characters, and it does the substitution.
However, if the reverse is true (and in most cases it is), I receive the error:
Quote:
awk: syntax error in regular expression !@#$%))*#$%^ at )*#$%^
Is there something I can do to the script that will treat both columns (or matches), as literals? I say matches because I'm actually not sure if it is my passwords.csv file containing the special character password, or the file that contains it, that is breaking this. Whatever it is, I'd like to have this script work.
Ive got a file with words and also numbers.
Bla BLA
10 10
11 29
12 89
13 35
And i need to change "10,29,89,25" and also remove anything that contains actually words... (4 Replies)
I have a file "fwcsales_filenames.txt" which has a list of file names that are supposed to be copied to another directory. In addition to that, I am trying to extract the date part and write to the log.
I am getting the regular expression error when trying to strip the date part using the "ll"... (1 Reply)
Hello world,
I was wondering if there is a nicer way to write the following code (in AWK):
awk '
FNR==NR&&$1~/^m$/{tok1=1}
FNR==NR&&$1~/^m10$/{tok1=1}
' my_file
In fact, it looks for m2, m4, m6, m8 and m10 and then return a positive flag. The problem is how to define 10 thanks... (3 Replies)
Hello,
This is my first post so, Hello World! Anyways, I'm learning how to use unix and its quickly become apparent that a strong foundation in regular expressions will make things easier. I'm not sure if my syntax is messing things up or my logic is messing things up.
ps -e | grep... (4 Replies)
Hello,
I'm working on learning regular expressions and what I can do with them. I'm using unix to and its programs to experiment and learn what my limitations are with them.
I'm working on duplicating the regular expression:
^(.*)(\r?\n\1)+$
This is supposed to delete duplicate lines... (2 Replies)
Hi ,
I am having an issue with the Awk script to insert newline for a regular expression match
Having a file like this
FILE1
####################
RXOER , RXERA , RXERC , RXERD
.RXEA(RXBSN), RXERD , REXCD
input RXEGT
buffer RXETRY
#######################
Want to match the RXE... (38 Replies)
Hi all,
How am I read a file, find the match regular expression and overwrite to the same files.
open DESTINATION_FILE, "<tmptravl.dat" or die "tmptravl.dat";
open NEW_DESTINATION_FILE, ">new_tmptravl.dat" or die "new_tmptravl.dat";
while (<DESTINATION_FILE>)
{
# print... (1 Reply)
Hello,
I have big files which I wanna filter them based on first column.
first column should be one of these strings: chr2L || chr2R || chr3L || chr3R || chr4 || chrX
and something like chr2Lh or chrY or chrM3L is not accepted.
I used the following command:
awk '{ if ($1=="chr2L" ||... (5 Replies)
hi All ,
I am having a large file with lots of modules as shown below
###############################################
module KKK
kksd
kskks
jsn;lsm
jsnlsn;
Ring
jjsjsj
kskmsm
jjs
endmodule
module llll
1kksd11
k232skks
j33sn;l55sm (6 Replies)