I'm trying to make a little script, but I have a problem...
I'm trying to sed a list of files made with a ls > filename.txt...
Two variables (or i may call them constant because they are fixed values :D):
ststr1 and ststr2
I want to
sed s/"$ststr1"/"$ststr2"/g filename.txt > listofsqlcommands.txt
The problem is that in ststr2 there is a string like "into table xxxxxx field terminated by ',' lines terminated by '\n' (col1, col2, col3 etc. etc.);"...
I can't change that because these files are created on windows and BY DESIGN when u create a text file with any method u get a newline at the end of file... :X
So, when i create the file with the list of sql command which have to insert the data of every file listed in filename.txt
filename.txt
filename1
filename2
filename3...
listofsqlcommands.txt
insert filename1 data into
insert filename2 data into
insert filename3 dat....
I get this result:
insert blah blah... ...lines terminated by '
' (col1, col2, col3...);
It's possible to made it like:
insert blah blah... ...lines terminated by '\n' (col1, col2, col3...);
????????
To make it simple, it's possible when sed a file that contains \n to avoid that the output file redirected contains a REAL newline????
Thx to everyone and sorry for my terrible way of speaking...