Script batch with command sed

hi,
i have a folder with 2000 text file where each file contain a string.
i need to trasform this string like this:

example of file : My name is Mark and I'm a child

the new file must be:

insert into tabella ('My name','My name is Mark and I'm a child');

where the first column is a substring of the string of file.

i try to use a command sed but i don't know how
thks so much

Could you please add more details on your statement
where the first column is a substring of the string of file.

What is the rule to fetch the substring? Is it first n characters or first 2 words?

Also please clarify on phrase each file contain a string .
So, is "My name is Mark and I'm a child" the sole content of the file? Does each file contain only one line?

the substrig is the first n characters

the string of files is every different and contain 1 line but different length

DIR=/directory/with/2000/files
for FILE in $(ls $DIR)
do
 echo "insert into tabella ('"$(awk '{print substr($0,1,7)}' $DIR/$FILE)"','"$(cat $DIR/$FILE)"');"
done

Beware of ' appearing within fields for inserts to be successful.

thks so much for your replay
it's work but substr return error... i try substr($FILE,1,7) but doesn't work

thks

Change only the directory name assigned to variable DIR. Leave the remaining as is. substr should be on the line and hence $0 for awk to read the line.

i try but doesn't work
return this error

 line 1: awk{print substr($0,1,7)}: command not found

Could you paste the entire script? Ensure you have the hashbang line at the beginning to denote the shell.. Example: #!/usr/bin/ksh

Save it as a script -> .ksh or .sh and execute it

this is the error:

./prova.sh[6]: awk{print substr($0,1,7)}: not found

this is the script:

#!/usr/bin/ksh
DIR=/home/oracle/prova/manu
for FILE in $(ls $DIR)
do
  echo "insert into comments('"$(awk'{print substr($0,1,7)}' $DIR/$FILE)"','"$(cat $DIR/$FILE)"');" >> prova.txt
done

Try

$ echo "My name is Mark and I'm a child" | awk '{print "insert into tabella (""\x27"substr($0,1,7)"\x27","\x27"$0"\x27"")"}' OFS=,

insert into tabella ('My name','My name is Mark and I'm a child')

like this work, but with file?

---------- Post updated at 10:01 AM ---------- Previous update was at 07:11 AM ----------

i resolve... this is the script

#!/usr/bin/ksh
DIR=/home/oracle/prova/manu
for FILE in $(ls $DIR)
do 
   pippo=$(sed -e "s/'/''/g;s/\`/''/" $DIR/$FILE) 
   

  #echo $pippo | awk '{print "insert into tabella (""\x27"substr($0,1,7)"\x27","\x27"$0"\x27"")"}' >> prova.txt

thks at all
have a nice day

why don't you show real input