sed

Thibaut thibaut at fuse.co.uk
Tue Oct 2 16:25:12 UTC 2007


Hi

I would like to user sed to substitute fields in a file but, after 9  
fields, I don't know how to do it.
Indeed, \10 is understood as \1 with a 0 concatenate with it.

echo $file |
sed 's/\([^,]*\),\([^,]*\),\([^,]*\),\([^,]*\),\([^,]*\),\([^,]*\),\ 
([^,]*\),\([^,]*\),\([^,]*\),\([^,]*\),\([^,]*\)/INSERT INTO `user`  
(BranchCode, Contactcode, FullName,JobTitle, Title,  
strip_First        Name, FirstName, strip_LastName, LastName,  
ContactNo, JobTitle, CompanyName, Address1, Address2, Address3,  
PostalTown, Postcode) VALUES ("\1", "\2", "\2", "\3", "\3", "\4",  
"\5", "\6", "\7", "\8", "\        9", "\10", "\11");/' > $finalFile


Do you know how to solve my problem ?

Cheers
Thibaut





More information about the ubuntu-users mailing list