linux - Scanning the output of a program at shell -
hello trying make script file in linux has input output of o prgram , scans find how many occurences of words existed. clearer want scan output , store variables how many times words exist in output. new scripitin in linux. tried storing output in file , scan line line in order find words somre reason loop use parse never ends. can me? ./program > buffer.txt while read line echo $line | grep word1 #when use grep command loop never ends done <a.txt edit: in c equivalent program be char* word="word1" while(/*parse lines @ text */) { fgetline("file_a",&buffer) if(strcmp(buffer,word)==0) strcpy(word1,"word") //continue search } the easiest thing skip writing file altogether if ./program | grep -q word1 &>/dev/null; echo "true" fi -q tells grep quiet, can still produce error messages can suppress w/the &>/dev/null. if you'd prefer see error messages, remove part. if want ./program's error...