Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8137259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T11:03:21+00:00 2026-06-06T11:03:21+00:00

Suppose I have file which goes like this : a void measure() { a

  • 0

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 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T11:03:27+00:00Added an answer on June 6, 2026 at 11:03 am

    It’s very difficult to tell what you’re asking, but it sounds like you might want this

    grep -q ^a file.c && echo 'The file is appended' || echo 'the file is clean'
    

    Or perhaps you really want this:

    grep -L ^a *.c
    

    Each resulting file name being an “appended” file.

    For multiple files you could do it this way

    for file in *.c ; do
       grep -q '^a ' file.c && echo 'The file is appended' || echo 'the file is clean'
    done
    

    For multiple files recursively, try

    find . -type f -name '*.c' -exec grep -q '^a ' {} \; -print
    

    Although to get the ‘correct’ output you’d need more work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose, I have a js file which looks like this: $(document).ready(function() { // first
Suppose that we have file like this: sometext11 sometext12 sometext13 sometext21 sometext22 sometext23 Texts
Suppose I have something like this: <span class=filesize>File<a href=http://example.com/image.jpg target=_blank>image.jpg</a>-(1.61 MB, 1000x1542, <span title=what
Suppose I have a file X.h which defines a class X, whose methods are
in python , suppose i have file data.txt . which has 6 lines of
Suppose i have a xml file which has several nodes & children. I am
Assume I have a sample source file, test.c, which I am compiling like so:
Suppose I have a 400K text file which I want to read from a
Suppose I have a custom file format, which can be analogous to N tables.
Suppose this situation : I have a dll which was written in standard c++,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.