I tried something but Resus mainly not know how to read the file line by line to compare lines between them, I get the error segmentation fault ( core dumped ). This is my function for uniq -u command
void uniq_u()
{
// strcpy(file_name1,params[2]);
FILE *file = fopen ( file_name1, "r" );
if ( file != NULL )
{
fgets(prev, sizeof prev,file);
while ( fgets ( line, sizeof line, file ) != NULL ) /* read a line */
{
if(!strcmp(line, prev))
printf("%s", prev);
else
strcpy(prev,line);
}
fclose ( file );
}
}
Thanks!