Computing.Net > Forums > Unix > Unix scripting question

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Unix scripting question

Reply to Message Icon

Name: vande
Date: April 9, 2008 at 07:46:58 Pacific
OS: Unix
CPU/Ram: idk :)
Product: :)?
Comment:

ok so im gonna paste some code can some one explain one thing to me. And that is where fld1 ,2 ,3 filemonth fld 5 etc come from its reading these folder/ files but...........
# File cleanup
if [ -e ftemp1$$ ]
then
cat ftemp1$$ |
while read fld1 fld2 fld3 filemonth fld5 fileyear filename fld99
do
echo "$filemonth$fileyear $filename" |
grep -v ${month[0]} | grep -v ${month[1]} |
grep -v ${month[2]} | grep -v ${month[3]} |
grep -v ${month[4]} | grep -v ${month[5]} |
grep -v ${month[6]} | grep -v ${month[7]} |
grep -v ${month[8]} | grep -v ${month[9]} |
grep -v ${month[10]}| grep -v ${month[11]} |
grep -v ${month[12]} >> ftemp2$$
done

cat ftemp2$$ |
while read fld1 filename
do
rm 2>/dev/null $filename
ls -l 2>/dev/null $filename >> $outfile
done
fi


there is more to the code and ftemp1$$ exist
everything works im just trying to understand a part of this code ...... and there is no where else where these folders/files its reading are created nor are they in the directory this script is ran from they dont exist how can you read on something that isn't there? well miswell not say that cause the script works so they must be logically created some how

Learning in progress..........



Sponsored Link
Ads by Google

Response Number 1
Name: ghostdog
Date: April 9, 2008 at 17:03:45 Pacific
Reply:

this is a rather messy script. you don't need that many greps and useless cats. Just tell what are you trying to do and show by examples.


0

Response Number 2
Name: vande
Date: April 9, 2008 at 17:27:01 Pacific
Reply:

Well that is one portion of the script if i gave you whole thing this grepping makes sense

Learning in progress..........


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Unix scripting question

Unix Script - simple question pleas www.computing.net/answers/unix/unix-script-simple-question-pleas/3792.html

C shell unix script file www.computing.net/answers/unix/c-shell-unix-script-file/4444.html

Unix script in DOS w/ questions www.computing.net/answers/unix/unix-script-in-dos-w-questions/5848.html