Printing string between pattern using sed


I have to extract the first parameter of the following function calls using sed.

strlcpy(p->name,getInfo(NULL,&account)); strlcpy(p->balance,getInfo(NULL,&account)); strlcpy(p->number,getInfo(NULL,&account)); strlcpy(p->address,getInfo(NULL,&account));

Expecting the result of string as below.

p->name p->balance p->number p->address

The following command prints the additional details, I am expecting only the first parameters.

sed -n 's/strlcpy(\(.*\),/\1/p' kk.txt p->name,getInfo(NULL&account)); p->balance,getInfo(NULL&account)); p->number,getInfo(NULL&account)); p->address,getInfo(NULL&account));


sed -n 's/.*strlcpy(\([^,]*\).*/\1/p' kk.txt


  • How to convert CRON string to ScheduleExpression in Java?
  • how to get context of a tapped list item to show details in another page in Nativescript
  • Accessing types defined inside package from java
  • How to join two tables and map the result to a case class in slick
  • Foreach and modification to iteration variable
  • How to get elements with a unique number from a json array in PostgreSQL?
  • How to manage state in JAX-RS?
  • Creating References to Objects
  • Excel VBA Intersect
  • How to get the index of element in the List in c#
  • Generating anchors with PyYAML.dump()?
  • how to set to NULL all the filestream varbinary(max) fields?
  • Configure Spring's MappingJacksonHttpMessageConverter
  • How to autopopulate a field in SugarCRM form
  • Unable to decode certificate at client new X509Certificate2()
  • Needing to do .toArray() to get output of mongodb .find() on key name not value
  • Meteor: Do Something On Email Verification Confirmation
  • Cannot resolve symbol 'MyApi'
  • Is there a javascript serializer for JSON.Net?
  • How to get address from latitude and longitude android google map v2 [duplicate]
  • Java Scanner input dilemma. Automatically inputs without allowing user to type
  • How to make a tree having multiple type of nodes and each node can have multiple child nodes in java
  • Where to put my custom functions in Wordpress?
  • Symfony2: How to get request parameter
  • ORA-29908: missing primary invocation for ancillary operator
  • Rearranging Cells in UITableView Bug & Saving Changes
  • Circular dependency while pushing http interceptor
  • Linker errors when using intrinsic function via function pointer
  • Windows forms listbox.selecteditem displaying “System.Data.DataRowView” instead of actual value
  • Buffer size for converting unsigned long to string
  • using HTMLImports.whenReady not working in chrome
  • FormattedException instead of throw new Exception(string.Format(…)) in .NET
  • need help with bizarre java.net.HttpURLConnection behavior
  • LevelDB C iterator
  • Reading document lines to the user (python)
  • Binding checkboxes to object values in AngularJs
  • How can i traverse a binary tree from right to left in java?
  • Net Present Value in Excel for Grouped Recurring CF
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize
  • How to load view controller without button in storyboard?