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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:02:51+00:00 2026-06-12T04:02:51+00:00

(Linux newbie here) I have a directory containing a master file ‘cs010101.SETUP’ and a

  • 0

(Linux newbie here)

I have a directory containing a master file ‘cs010101.SETUP’ and a number of sub-directories. Each sub-directory contains a large number of files including some of the format cs??????.dat3. I’m looking for a way to find all the cs??????.dat3 files and then for each, in its corresponding directory, create a soft link back to the master file (cs010101.SETUP) with the six digit number changed to the match the respective cs??????.dat3 file.

e.g If a sub-directory contains the file cs219254.dat3, I want to perform the command

ln -s ../cs010101.SETUP cs219254.SETUP

So far I’ve got as far as the find command

find . -name "cs*dat3"

and looked at piping to cut in order to extract the number

find . -name "cs*dat3" | cut -c 13-18

(this works currently as the naming convention for the sub-directories is consistent, though would be nice if didn’t have to rely on that fact).

But now I’m stumped!

  • 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-12T04:02:52+00:00Added an answer on June 12, 2026 at 4:02 am

    Use sed. Script may look like this:

    for dname in `find . -maxdepth 1 -name "*" -type d`; do #list all subdirectories of this directory only
        for fnum in `find $dname -name "cs*.dat3" | sed 's/^.*cs\([0-9]*\)\.dat3$/\1/'`; do #extract numbers of needed files in subdir
            ln -s $PWD/cs010101.SETUP $dname/cs$fnum.SETUP #create link
        done
    done
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am a newbie in APE. I have a linux machine that runs the
I am newbie to j2ee. I have download and installed j2eesdk-1_4_03-linux.bin in my ubuntu
Pretty much a complete Linux/Apache newbie here, I am in the process of moving
Apologize in advance, I am a newbie in Linux and these stuffs. I have
Ok newbie linux question here but i cant for the life of me find
I am a newbie in GCC and Linux. I have been using Visual Studio
I'm a newbie following the RailsTutorial.org program and have installed/setup rvm, ruby 1.9.2,rails, curl,
I'm a Drupal newbie, but have successfully installed it at a CentOS 5.5 Linux,
As being quite a newbie in linux, I have the follwing question. I have
I'm a linux newbie coming from a Windows background and I am trying to

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.