Live Chat & Podcast at 1:00PM Eastern on Sunday!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Linux and Unix
Tag Cloud
access acer asus bios bsod computer crash desktop driver drivers error ethernet excel freeze gaming hard drive hardware hdmi internet laptop malware memory modem monitor motherboard network printer problem ram registry router security slow software sound toshiba trojan ubuntu 11.10 uninstall usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Operating Systems > Linux and Unix >
Solved: KSH script question

Reply  
Thread Tools
surfnschultz's Avatar
Member with 191 posts.
 
Join Date: Nov 2003
28-Feb-2005, 02:30 PM #1
Solved: KSH script question
How can I write a script that reads a long list of items and use one itme at a time to run a job with the line item in the file? Trying to delete a few hundred items and trying to automate it as much as possible. Not too happy if I have to do this by hand.

I know how to read a single item entered at the command line, not sure about a open read of a file with hundreds of items.


OK guru's the race to solution is on...
surfnschultz's Avatar
Member with 191 posts.
 
Join Date: Nov 2003
28-Feb-2005, 03:23 PM #2
This is what I got so far, BUT it's not working
exec 4<data.txt
while read each_line <$4
do
echo ${each_line}
done
exec 4<&-


This is what I got so far, but it is not working. It still waits for my input at the command line. If I type 1 it echo's 1 to the screen. I want ti to read my data.txt file which has in for testing purposes 1,10,20,30... to 50

Any more info would be helpful.
surfnschultz's Avatar
Member with 191 posts.
 
Join Date: Nov 2003
28-Feb-2005, 05:52 PM #3
got it working!
Well here is what I used, kind of lame, but works for now.

While read line_by_line
do
echo $ {line_by_line}
done < data.txt


this works, I am stoked.
Reply

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 11:04 PM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.