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 952623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:55:28+00:00 2026-05-15T23:55:28+00:00

I have a file with function prototypes like this: int func1(type1 arg, int x);

  • 0

I have a file with function prototypes like this:

int func1(type1 arg, int x);

type2 funct2(int z, char* buffer);

I want to create a script (bash, sed, awk, whatever) that will print

function = func1 // first argument type = type1// second argument type = int
function = func1 // first argument type = int// second argument type = char*

In other words, tokenize every line and print the function names and arguments. Additionally I would like to hold these tokens as variables to print them later, eg echo $4.

  • 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-05-15T23:55:29+00:00Added an answer on May 15, 2026 at 11:55 pm

    here’s a start.

    #!/bin/bash
    #bash 3.2+
    while read -r line
    do
      line="${line#* }"
      [[ $line =~ "^(.*)\((.*)\)" ]]
      echo  "function: ${BASH_REMATCH[1]}"
      echo  "args: ${BASH_REMATCH[2]}"
      ARGS=${BASH_REMATCH[2]}
      FUNCTION=${BASH_REMATCH[1]}
      # break down the arguments further.
      set -- $ARGS
      echo "first arg type:$1 , second arg type: $2"
    done <"file"
    

    output

    $ ./shell.sh
    function: func1
    args: type1 arg, int x
    first arg type:type1 , second arg type: arg,
    function: funct2
    args: int z, char* buffer
    first arg type:int , second arg type: z,
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 534k
  • Answers 534k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer No. I was looking for the non-trivial pseudo-code to find… May 17, 2026 at 12:40 am
  • Editorial Team
    Editorial Team added an answer You have several options: Create a package configuration table as… May 17, 2026 at 12:40 am
  • Editorial Team
    Editorial Team added an answer class Float def round_point5 (self * 2).round / 2.0 end… May 17, 2026 at 12:40 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have this code: void PrintMainParameters(int n, char* array[]) { int i = 0;
I have an m-file function with 4 outputs. I would like to define an
I have a set of assembly function which I want to use in C
I have PHP function file with ~2,000 rows and I always include it for
I would like a command line function that I can run on any file
Linux has this nice function dprintf : The functions dprintf() and vdprintf() (as found
I've been tasked with updating a function which currently reads in a configuration file
this is my demo code : <body onload=initialize()> <script> function initialize(){ var d='adddd' $.getScript('other.js',
I have file test.pdf in my Application Bundle. I run test in iPhone Simulator
I have a perl hash of hashes like the following: $VAR1 = { 'ID_1'

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.