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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:43:01+00:00 2026-05-26T22:43:01+00:00

I have a dictionary file formatted like this: A B [C] D Where a

  • 0

I have a dictionary file formatted like this:

 A B [C] D

Where a is a word (with no spaces), B is another word (with no spaces inside it), C is the pronunciation (there are spaces here), and D is the definition expressed in words (there are spaces, and a variety of symbols).

I wish to separate it into 4 parts, like this:

 A@@@@B@@@@C@@@@D

In this way, the first space is converted to @@@@, the first [ is converted to @@@@, and the first ] is converted to @@@@. This will allow easy import into a spreadsheet as a CSV (@@@@‘s serve as the commas).

Can this be achieved with awk or another tool in BASH?

Update:

Here are some samples:

一千零一夜 一千零一夜 [Yi1 qian1 ling2 yi1 ye4] /The Book of One Thousand and One Nights/
灰姑娘 灰姑娘 [Hui1 gu1 niang5] /Cinderella/a sudden rags-to-riches celebrity/
雪白 雪白 [xue3 bai2] /snow white/

Would be converted to:

一千零一夜@@@@一千零一夜 @@@@Yi1 qian1 ling2 yi1 ye4@@@@ /The Book of One Thousand and One Nights/
灰姑娘@@@@灰姑娘 @@@@Hui1 gu1 niang5@@@@ /Cinderella/a sudden rags-to-riches celebrity/
雪白@@@@雪白 @@@@xue3 bai2@@@@ /snow white/

Consider that anything might appear after the third set of @@@@‘s, including more spaces, [, etc., however, before the third @@@@, everything is consistent in format.

  • 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-26T22:43:01+00:00Added an answer on May 26, 2026 at 10:43 pm

    I think sed will be easier:

    sed -e 's/ /@@@@/' -e 's/ [/@@@@/' -e 's/] /@@@@/' infile > outfile
    

    By default (i.e. if you don’t specify the g modifier at the end) substitutions only work once per line.

    Or, if you want to do it in-place:

    sed -i -e 's/ /@@@@/' -e 's/ [/@@@@/' -e 's/] /@@@@/' infile
    

    (but not all versions of sed support that, and you’ll lose your input file)

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

Sidebar

Related Questions

I have this dictionary in my apps model file: TYPE_DICT = ( (1, Shopping
I have file which contains some data, like this 2011-01-02 100100 1 2011-01-02 100200
Suppose I have Dictionary like this: Dictionary<string, string> values = new Dictionary<string, string>() {
I have a file with ids and information, like this: 1oMZgkoaz3o 2011-12-29T01:23:00.000Z 9 503
I have the following decleration: private Dictionary<string, Dictionary<string, File>> listFiles = new Dictionary<string,Dictionary<string,File>>(); How
Does VBA have dictionary structure? Like key<>value array?
I have a dictionary of data, the key is the file name and the
I have a word file with 3 words. I need to read each word
I have an unsorted dictionary file named dict.txt. I have managed to put the
I have a tough problem right now. I am having a big dictionary file

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.