Are you reading the data from a text file? is this on an embedded platform?
If you are reading from a text file where all the data is ASCII, then you can get read a few bytes at a time and check for the newline '\n' (0X0A).
void FindAndUpdate(void)
{
unsigned char buffer[256];
unsigned char newBuffer[sizeof(buffer)+1];
unsigned char *pChr;//pointer to where the \n is
unsigned short location = 0, bytesRead, bytesWrote;
FIL file, newFile;
f_open(&newFile, "new.txt", FA_WRITE | FA_OPEN_APPEND );
f_open(&newFile, "old.txt",FA_READ);
do{
f_read(&file, buffer, sizeof(buffer), &bytesRead);
pChr = strchr(buffer, '\n');
if (NULL != pChr)
{
location = (pChar - &buffer[0]) - 1;
//get where the \n is and minus 1 to get the index before it
memcpy(newBuffer, buffer, location); //copy bytes to spot before \n
newBuffer[location] = 0X0D; // insert '\r'
memcpy(&newBuffer[location +1], pChr, bytesRead - location); //copy the rest of the array
f_write(&newFile, newBuffer, sizeof(newBuffer), &bytesWrote);
}
}while(bytesRead != 0);
f_close(&file); //close file
f_close(&newFile);//close file
f_unlink(new.txt);//delete old file
f_rename("old.txt", "new.txt");//rename file back to the origina name
}