I'm using this command
sed -e "s/'/'/g" -e 's/"/"/g' -e 's/&/\&/g' myfile.txt
My question is does this command reads file 3 times applying different replacement each time or it reads it only once and do 3 replacements at the same time?
My concern is, since I have big files (1 MB or more) that if its' first case - it will be very slow as list of different replacements grow. Have 3 now but can have 15 in a future!? Now it takes 45 minutes for 1mb file.
-e script script is an edit command for sed . See USAGE
below for more information on the format of
script. If there is just one -e option and no -f
options, the flag -e may be omitted.
-f script_file
Take the script from script_file. script_file con-
sists of editing commands, one per line.
Multiple -e and -f options may be specified. All commands
are added to the script in the order specified, regardless
of their origin.
Thanks, this explains it :
$ man sed
-----
A script consists of editing commands, one per line, of the following
form:
[address[,address]]function[arguments ]
In normal operation, sed cyclically copies a line of input into a
pattern space \(unless there is something left after a D command\),
applies in sequence all commands whose addresses select that pattern
space, and at the end of the script copies the pattern space to the
standard output \(except under -n\) and deletes the pattern space.