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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:06:59+00:00 2026-06-13T12:06:59+00:00

I have $ cat awktestf a++ b++ c++ I am doing and I get

  • 0

I have

$ cat awktestf 
a++
b++
c++

I am doing and I get

cat  awktestf | awk 'BEGIN { RS="++" ; OFS="@"; ORS="()" } { print $0 } END {print "I am done" }'
a()
b()
c()
()I am done()abc@abc:~$ 

My question is why am I getting an extra () at the end?

Even this does not work:

$ echo 'a++
> b++
> c++' | awk 'BEGIN { RS="++" ; OFS="@"; ORS="()" } { print $0 } END {print "I am done" }'
a()
b()
c()
()I am done()abc@abc:~$ 
  • 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-13T12:07:00+00:00Added an answer on June 13, 2026 at 12:07 pm

    ORS is appended to the end of each output record. Hence your “I am done” ends with ().


    Misunderstood the question the first time.

    This

    a++
    b++
    c++
    

    translates to

    a++\nb++\nc++\n
    

    After splitting into records using RS, you get these records

    1. a
    2. \nb
    3. \nc
    4. \n

    When you print them, each record is terminated with ORS, (), so

    a()\nb()\nc()\n()
    

    You added “I am done”

    a()\nb()\nc()\n()I am done()
    

    Hence this is displayed as

    a()
    b()
    c()
    ()I am done()
    

    (Since the last line does not end with a newline, your prompt shows on the same line)

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

Sidebar

Related Questions

Lets say I have two tables - Cat and Cat owner that are linked
I have this array: $pets = array( 'cat' => 'Lushy', 'dog' => 'Fido', 'fish'
I have this in my makefile test: cat t.txt | sort -t $$'\t' -k
I have a url http:// * .com/branch/module/view/id/1/cat/2/etc/3. It becomes. array ( 'module'=>'branch', 'controller'=>'module', 'action'=>'view'
If I have a string that contains Cat how could I check before hand
I have some codes like this: cats = Category.objects.filter(is_featured=True) for cat in cats: entries
I have a list of, let's say [Cat, Dog, Cow, Horse] , that I
Hi i have come across some urls of the type http://localhost/jsfweb/cat/query/ where query is
I have a file with the following information: dog<> cat<> cow<> bird<> tiger<> lion<>
Example: I have an Cat entity with an catAge attribute. In the data modeler,

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.