Help Me please scripting 101


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Help Me please scripting 101
# 1  
Old 10-01-2009
Help Me please scripting 101

Hi, I had to pull a handful of account numbers from a file into a table. Now I want to do a basic list from a directory in my program showing me if any files for these customers exist. There are files associated with each client and need to be processed individually.
$Paytos = 00153301 00153302 00153303 00153304 (=client numbers)

ls -tr ${Paytos}

This would list anything equal to 00153301 00153302 00153303 but I need it to list the following files:
00153301.100109
00153302.100109
00153303.100109

I tried ls -tr ${Paytos}.* but no go?

Thanks.
# 2  
Old 10-01-2009
pls post more details!

exp: file currently
cat file
result .
...


should be
cat file | ... commands ....
result......
# 3  
Old 10-01-2009
Client database
CUSTNUMBER="${USERID} 00153301 00153302 00153303 00153304

Program pulls this information for each client.
CustNumber="('"
for number in ${CUSTNUMBER}
do
[ `echo "${number}" | grep -c -e[a-z]` -gt 0 ] && continue
PayToS="${PayToS}${number} "
CustNumber="${CustNumber}${number}', '"
done

Files go on hold daily:
00153301.052090
00153302.052104

Program needs to find all available files and process. I was trying to accomplish this by capturing the paytos and listing all them, reading the file and processing them but my payto's do not have the end of the file after the period.
Hope this makes sense.
# 4  
Old 10-01-2009
Quote:
Originally Posted by research3
pls post more details!

exp: file currently
cat file
result .
...


should be
cat file | ... commands ....
result......
You just got a UUOC Award. Smilie Remember, whenever you're doing cat foo | something, you should do something <foo instead to save your computer the trouble of launching an extra process and doing umpteen pointless extra reads and writes.
# 5  
Old 10-03-2009
Quote:
Originally Posted by ski
Hi, I had to pull a handful of account numbers from a file into a table. Now I want to do a basic list from a directory in my program showing me if any files for these customers exist. There are files associated with each client and need to be processed individually.
$Paytos = 00153301 00153302 00153303 00153304 (=client numbers)

ls -tr ${Paytos}

This would list anything equal to 00153301 00153302 00153303 but I need it to list the following files:
00153301.100109
00153302.100109
00153303.100109

I tried ls -tr ${Paytos}.* but no go?

Thanks.
I'm still not sure I understood you correctly, but given that E contains the extension
Code:
for F in $Paytos; do
  ls ${F}.$E
done

Regards,

pen
# 6  
Old 10-03-2009
Quote:
Originally Posted by Corona688
You just got a UUOC Award. Smilie Remember, whenever you're doing cat foo | something, you should do something <foo instead to save your computer the trouble of launching an extra process and doing umpteen pointless extra reads and writes.
Dear Corona688, that was just an example of me!
note: time --> command ---> result ---> resource
 
Login or Register to Ask a Question

Previous Thread | Next Thread

2 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash 101 - to (do) ; or not to (do) ; ?

I figured this forum needs some laughs , so I am posting this. And if the answer is - it depends on bash version - do not reply. This is from "manual" while CONTROL-COMMAND; do CONSEQUENT-COMMANDS; done And here is the REAL code - no ";" while do xterm & i=$ done (2 Replies)
Discussion started by: annacreek
2 Replies

2. Shell Programming and Scripting

Daemon 101

I think I have an issue almost like Sammy_T's. I want to make a piece of code run as a daemon. I have some java, along with it 15 classpath's converted to a shell script that I can "runmyjavap". The script is just what I need to run after compiling it: #!/bin/sh java -classpath : ...(from... (3 Replies)
Discussion started by: Miller_K
3 Replies
Login or Register to Ask a Question