Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

For loop for creating folders from file

form for loop loop

  • Please log in to reply
3 replies to this topic

#1 Kintamasis

Kintamasis

    CC Lurker

  • Just Joined
  • Pip
  • 7 posts

Posted 06 December 2011 - 05:08 AM

Hello, I'm new in bash scripting and i need some help with for loop script. I have file name - YER and in this file are 4 words as,sd,df,fg . I need to create
a for loop that take information from YER file and create 4 folders(as,sd,df,fg). can some one help me ?
  • 0

#2 Kintamasis

Kintamasis

    CC Lurker

  • Just Joined
  • Pip
  • 7 posts

Posted 06 December 2011 - 07:48 AM

no one knows ?
  • 0

#3 xtatics

xtatics

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 08 December 2011 - 06:26 PM

Different ways you can do it.

for folder in $(cat YER) ; do mkdir $folder ; done
  • 0

#4 DarkLordCthulhu

DarkLordCthulhu

    CC Devotee

  • Senior Member
  • PipPipPipPipPipPip
  • 422 posts
  • Location:The bash shell
  • Programming Language:C, JavaScript, Bash, Others
  • Learning:Ruby, Others

Posted 09 December 2011 - 05:43 AM

I suggest using sed or awk if you want to extract parts of a text file.

Amazon.com: sed & awk (2nd Edition) (9781565922259): Dale Dougherty, Arnold Robbins: Books
  • 0
Programming is a journey, not a destination.





Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download