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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:37:21+00:00 2026-06-14T23:37:21+00:00

I require some help in reading and updating a csv file using Shell script.

  • 0

I require some help in reading and updating a csv file using Shell script. I have written the below code to read the csv file and it works fine.

#!/bin/sh
#This script is to read the excel data
IFS=","
echo "Starting to read csv"
i=1
while read f1 f2
do
    test $i -eq 1 && ((i=i+1)) && continue
    echo "tenantID is :$f1"
    echo "status is   :$f2"

#The below command will update the schema with data

java -Xmx512m -XX:MaxPermSize=128m -jar biz.jar -install -readers=seed -          delegator=default#$f1

done < TenantId.csv

echo "end of file "

The above code is working fine. I.e it reads the csv file and passes the tenantID to the java arg. Once the java processing is done, I would like to update the status(f2) with some values. Also in the above code,blank lines are also getting executed.I would like to know how to process only the lines where data is present. Please let me know how to acheive the same.

Thanks in Advance

  • 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-14T23:37:23+00:00Added an answer on June 14, 2026 at 11:37 pm
    while read f1 f2
    do
        test $i -eq 1 && ((i=i+1)) && continue
        [ -z "$f1" ] && continue
        echo "tenantID is :$f1"
        echo "status is   :$f2"
    
        #The below command will update the schema with data
    
        java -Xmx512m -XX:MaxPermSize=128m -jar biz.jar -install -readers=seed -          delegator=default#$f1
    
        echo $f1, XXX >> TenantIdOut.csv
    done < TenantId.csv
    

    Added 2 lines of code:

    1. If the f1 is null, continue – This is to skip blank lines.
    2. Write the record f1 and new status to a new file , and outside the loop you can rename the input file with this new file.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What will work faster - using PEAR package or require Some_Library.php files in code?
i have a validation class which needs improving. If I require some custom validation
I have a singleton object that use another object (not singleton), to require some
I have a asp.net mvc application. Some pages require SSL, is there a way
I have some classes in my app that don't require an ID to be
I have, after some help ( MSChart - Forcing a line chart to draw
I need some help in transforming an input data which is from reading a
I am a Perl newbie, stuck with another bioinformatics problem that requires some help
I'm working on a Google App Engine program that will require some basic spell
I'm looking to design an application that will require some deep control over IP

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.