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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:55:36+00:00 2026-05-13T05:55:36+00:00

I getting space delimited list of titles based on this code: TITLES=`awk -F’|’ ‘{print

  • 0

I getting space delimited list of titles based on this code:

TITLES=`awk -F'|' '{print $1}' titles.txt | cut -d'=' -f2 | sort

Then I use that list in a for loop to print out the results:

for T in $TITLES
do
     echo "$T"
done

The problem is that when a title has more than one word and the words are separated by a space then my for loop prints them out as separate things.

I tried adding double qoutes using sed to each title but that just caused the loop to print each word in double quotes rather then the two word titles together.

How can I fix this?

  • 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-13T05:55:36+00:00Added an answer on May 13, 2026 at 5:55 am

    One way to do this is to set IFS:

    IFS='
    '
    for T in $(awk -F'|' '{print $1}' titles.txt | cut -d'=' -f2 | sort)
    do
         echo "$T"
    done
    

    This sets IFS to just newline (there’s a newline between the open and close single-quotes).

    I know this works in bash, but I’m not sure how portable it is to other shells.

    If you do this you’ll almost certainly want to set IFS back to its old value once you’re done the loop.

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

Sidebar

Related Questions

Given a colon-delimited list of paths, getting a space-delimited list with GNU Make is
I've been trying to figure out where I am getting this extra space between
I would like some help in getting this regex to accept the space character.
I'm getting this error and all i've found so far is remove the space,
I am getting a PermGen Space Exception whenever I deploy my web application. I
I am getting the following PermGen space error in executing the JasperFillManager.fillReport(reportFile.getPath(), parameters, conn);
Getting my head around Android, I've sort of trouble understanding support for multiple devices.
Getting red warning message that expected identifier for this statement CALayer = ImageView.layer; Using
Getting this out of the way; I don't frequently do much in php or
More specifically, why am I getting a space between strarray(1) and strarray(2) in newFilename?

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.