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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:26:03+00:00 2026-06-13T11:26:03+00:00

Problem Statement:- Below is the script that someone else wrote and he left the

  • 0

Problem Statement:-
Below is the script that someone else wrote and he left the company so I don’t know whom should I ask about this. So that is the reason I am posting here to find the solution.

What this script does is- It gzip the data from a particular folder (/data/ds/real/EXPORT_v1x0) for a particular date (20121017) and move it back to HDFS (hdfs://ares-nn/apps/tech/ds/new/) directory.

date=20121017
groups=(0 '1[0-3]' '1[^0-3]' '[^01]')
  for shard in 0 1 2 3 4 5 6 7 8 9 10 11; do
    for piece in 0 1 2 3; do
        group=${groups[$piece]}
        if ls -l /data/ds/real/EXPORT_v1x0_${date}_${shard}_T_${group}*.dat.gz; then
          gzip -dc /data/ds/real/EXPORT_v1x0_${date}_${shard}_T_${group}*.dat.gz | \
          hadoop jar /export/home/ds/lib/HadoopUtil.jar com.host.hadoop.platform.util.WriteToHDFS -z -u \
          hdfs://ares-nn/apps/tech/ds/new/$date/EXPORT-part-$shard-$piece
          sleep 15
       fi
    done
  done

So during the migration to HDFS I found out this file has some problem in HDFS-

hdfs://ares-nn/apps/tech/ds/new/20121017/EXPORT-part-8-3

So Is there any way by doing some permutation from the above script we can find out what are the files under this directory (/data/ds/real/EXPORT_v1x0) which ultimately got converted to this hdfs://ares-nn/apps/tech/ds/new/20121017/EXPORT-part-8-3 which has the problem.

Any thoughts?

Update:-

Something like this below?

groups=(0 '1[0-3]' '1[^0-3]' '[^01]')
  for shard in 0 1 2 3 4 5 6 7 8 9 10 11; do
    for piece in 0 1 2 3; do
        group=${groups[$piece]}
        if ls -l /data/ds/real/EXPORT_v1x0_${date}_${shard}_T_${group}*.dat.gz; then
          [ "$date/EXPORT-part-$shard-$piece" == "20121017/EXPORT-part-8-3" ] && {
                echo /data/real/EXPORT_v1x0_${date}_${shard}_T_${group}*.dat.gz
            }
         fi
    done
  done

Few Sample Files Format I have in the /data/real/EXPORT folder-

/data/real/EXPORT_v1x0_20121017_4_T_115600_115800.dat.gz
/data/real/EXPORT_v1x0_20121017_4_T_235600_235800.dat.gz
/data/real/EXPORT_v1x0_20121017_4_T_115800_120000.dat.gz
/data/real/EXPORT_v1x0_20121017_4_T_235800_000000.dat.gz

And few sample output that I got after making changes-

/data/real/EXPORT_v1x0_20121017_0_T_0*.dat.gz: No such file or directory
/data/real/EXPORT_v1x0_20121017_0_T_1[0-3]*.dat.gz: No such file or directory
/data/real/EXPORT_v1x0_20121017_0_T_1[^0-3]*.dat.gz: No such file or directory
/data/real/EXPORT_v1x0_20121017_0_T_[^01]*.dat.gz: No such file or directory
  • 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-13T11:26:04+00:00Added an answer on June 13, 2026 at 11:26 am

    In this case reaplce the whole gzip line to:

    [ "$date/EXPORT-part-$shard-$piece" == "20121017/EXPORT-part-8-3" ] && {
        echo /data/real/EXPORT_v1x0_${date}_${shard}_T_${group}*.dat.gz
    }
    

    That should do the trick.

    Edit: remove sleep to speed up the loop!

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

Sidebar

Related Questions

Problem Statement:- I have four shell script that I want to execute only when
I have a problem when trying to execute this update statement (below) using C#
I have a problem with the SQL statement detailed below. The query returns the
Problem statement: Find the right triangle that has integers for all sides and all
Problem statement We have one employer that wants to interview N people, and therefore
Here is the problem statement: Calling a setter on the object should result in
I have a pagination script which I have posted below, the problem is I
Below is my script that I am executing in the bash. And it works
Solution: The problem below was caused by a Divx javascript that overwrote a core
Below is my shell script that is working fine. #!/bin/bash DATE_YEST_FORMAT2=`perl -e 'use POSIX

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.