This removes \N, replaces it with " "and then chops off the last character of each line and inserts a space there. Do you know about dos2unix (or dos2ux)?
If you want it to run faster try using background processes:
cnt=0
find ./ -name "*.dmp" |\
while read file do
perl -pi -e 's/\\N/ /g; s/.$/ /g' $file &
cnt=$cnt+1
z=$(( $cnt % 10 ))
if [[ $z -eq 0 ]] ; then
wait
fi
done
wait
This runs ten process at the same time in background. And then waits for completion. The code you proivided does not replace the characters with a space
Really, the requirements are ridiculous. There is no way to search and replace anything in thousands of files quickly. You might find some ways to faster than others, but nothing is going to be a magic bullet. I suggest you try perls inplace editor, it might be faster than sed although I don't really know.
Hey , first of all sorry for posting here instead of starting the new thread. I could not find the link for starting a NEW thread.
"HERE GOES MY QUESTION"
can anyone please tell me how to search for a particular string in a file (I know the file name) and then accordingly increase the counter which is pre set to ZERO. and hence showing the total number of times the character/string is found.
awk '/pattern/{
gsub(/pattern/," ")
}
{
print $0 > FILENAME"-new.dmp"
f[FILENAME]=FILENAME"-new.dmp" #probably not here
}
END {
for ( i in f ){
cmd = "mv " f " " i
system(cmd)
}
}
' *.dmp