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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:24:15+00:00 2026-06-05T02:24:15+00:00

I am parsing a file to get the selected string and build into a

  • 0

I am parsing a file to get the selected string and build into a single line, however, I don’t know how to do it(as shown in //add…) in shell scripts

while read line
do
    tt=`echo $line | cut -d'|' -f2 | cut -d'"' -f1`
    //add a $total = add all tt parts into a big string seperate by ", "
done < tmp_file

echo $total >> outfile

thank you

  • 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-05T02:24:18+00:00Added an answer on June 5, 2026 at 2:24 am

    You append in the shell using assignment and variable expansion:

    total="${total}, ${tt}"
    

    The curly braces ({}) aren’t necessary in this case but I find they help distinguish variables when they’re next to each other like this.

    This will give you a leading “, “. You can work around it like this:

    total="${total:+${total}, }${tt}"
    

    The ${variable:+value} construct only expands to value if variable is set.

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

Sidebar

Related Questions

I'm parsing an XML file an get a string as NSMutableString . Now I
I'm parsing a properties file to get a list of properties defiend. I want
After parsing my file s contains AttributeGet:1,16,10106,10111 So I need to get all the
I am currently parsing an XML file to get a coordinate value using the
I'm a somewhat experienced PHP scripter, however I just dove into parsing XML and
After running a SPICE simulation I get an .a2d file which I am parsing
When parsing a large file I get the following error Caught: java.lang.OutOfMemoryError: Java heap
I am parsing xml file from url(in code below), using file_get_contents() function, and simpleXML,
Using simplexml_load_file(), if I'm parsing out XML and I get the following for image...
I'm parsing a file that is set up like so: <blah-name name=Turkey> <blah-city name=Test/>

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.