Suppose I have file which goes like this :
a void measure()
{
a GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_7); // Pin assignment
ADCSequenceConfigure(ADC0_BASE, 3, ADC_TRIGGER_PROCESSOR, 0);
appended line for demonstration
ADCSequenceStepConfigure(ADC0_BASE, 3, 0, ADC_CTL_CH0 | ADC_CTL_IE |ADC_CTL_END);
ADCSequenceEnable(ADC0_BASE, 3);//sample sequence 3 is enabled.
ADCIntClear(ADC0_BASE, 3); // Clear the interrupt status flag.
}
Can I use SED or AWK to output true if and only if a is prepended to the first coloum with space as the delimiter . The first character is always a otherwise space .
As of now I use GREP :
if grep -q "^a" file.c; then
echo "The file is prepended"
else
echo "the file is clean"
fi
I have several functions like the first one above in separate files and want to categorise it based on the prepended a .
Is it possible to do this easily and over multiple files using GREP itself .I would really prefer a SED or AWK alternative avoiding the use of the if construct for hundreds to come .
Suggestions or better algorithms are always welcome 🙂
It’s very difficult to tell what you’re asking, but it sounds like you might want this
Or perhaps you really want this:
Each resulting file name being an “appended” file.
For multiple files you could do it this way
For multiple files recursively, try
Although to get the ‘correct’ output you’d need more work.