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

  • SEARCH
  • Home
  • 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 8415271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T01:23:51+00:00 2026-06-10T01:23:51+00:00

I have a file in which have values in following format- 20/01/2012 01:14:27;UP;UserID;User=bob email=abc@sample.com

  • 0

I have a file in which have values in following format-

20/01/2012 01:14:27;UP;UserID;User=bob email=abc@sample.com

I want to pick each value from this file (not labels). By saying label, i mean to say that for string email=abc@sample.com, i only want to pick abc@sample.com and for sting User=bob, i only want to pic bob. All the Space separated values are easy to pick but i am unable to pick the values separated by Semi colon. Below is the command i am using in awk–

awk '{print "1=",$1} /;/{print "2=",$2,"3=",$3}' sample_file

In $2, i am getting the complete string till bob and rest of the string is assigned to $3. Although i can work with substr provided with awk but i want to be on safe side, string length may vary.
Can somebody tell me how to design such regex to parse my file.

  • 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-10T01:23:53+00:00Added an answer on June 10, 2026 at 1:23 am

    You can set multiple delimiters using awk -F:

    awk -F "[ \t;=]+" '{ print $1, $2, $3, $4, $5, $6, $7, $8 }' file.txt
    

    Results:

    value1 value2 value3 value4 label1 value5 label2 value6
    

    EDIT:

    You can remove anything before the equal signs using sub (/[^=]*=/,"", $i). This will allow you to just print the ‘values’:

    awk 'BEGIN { FS="[ \t;]+"; OFS=" " } { for (i=1; i<=NF; i++) { sub (/[^=]*=/,"", $i); line = (line ? line OFS : "") $i } print line; line = "" }' file.txt
    

    Results:

    20/01/2012 01:14:27 UP UserID bob abc@sample.com
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a following parameter file in which I want to change values on
I have a file which contains lines of data in the following format: a11
I have a file which contains lines of the following format: w1#1#x w2#4#b w3#2#d
Localizable strings file which are used for Apple/iPhone apps localization have the following format:
I have a dotx file which contains placeholders to be replaced with DB values
I have an external setting file which has some nodes holiding attribute values of
I have a classic ASP application which inserts some values into a word file
I have data in a csv file in the following format ,BC1,BC10,BC11 1,2432,420,18 2,276,405,56
I have data in a csv file in the following format 0,q20,q25,q30 0,32821,2270,68 1,105586,11366,38
I have a file(both .dat and .txt format) which contains numbers(integers) in rows and

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.