Unix shell scripting


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Unix shell scripting
# 1  
Old 10-21-2004
Data Unix shell scripting

I need to write a script which analyses an invoice file, counting the amount of pages in the file to be printed per account number and per invoice. The account numbers are stored in another file which has instructions on what do with ach customers invoice as per their account number.

please hlp...
# 2  
Old 10-21-2004
You will need to post a lot more information than that for anyone to be able to help you.

What OS are you using?
What shell are you using?
What does the data look like?
What programming language have you selected?
What have you coded thus far?
What specifically can you not figure out?
# 3  
Old 10-21-2004
Unix Shell Scripting

1) I think its Solaris.
2) Unix
3) The data in the invoice file is in free form and the data in the other file is in comma delimted format
4) unix shell scripting
5) I don't know much about Unix and all I have managed to do thus far is to write a script which unzips the free form file to a temp folder.
6) how to analyse the file so i can give a page count per account number
# 4  
Old 10-21-2004
Post samples of your data (both files).

Also, post the results of the command uname -a and echo $SHELL
# 5  
Old 10-21-2004
What OS are you using?
Run the command and post results: uname -a
What shell are you using? Unix is not a shell.
Run the command and post results: echo $SHELL

What does the data look like? - Your answer isn't much to go on - unless you post an example of the data, you may be on your own for this. You won't be able to write a script if you don't know what the data looks like to grab the information you need. We can't help since we don't have any clue on what the data looks like.

What programming language have you selected?
sh, ksh, csh, bash, tcsh, .... are examples of shells. Each can be used to write a shell script.

What specifically can you not figure out? 6) how to analyse the file so i can give a page count per account number.

We can't assist without knowing the layout of the file - if you can't post the format or part of the file (as it may be something you can't share with outsiders), then you need to look at it and figure it out.

How do you do this processes today (if at all)? Normally if you can look at how the process is done manually, you can code something to do it automatically.
# 6  
Old 10-21-2004
SunOS buffalo 5.8 Generic_117350-11 sun4u sparc SUNW,Ultra-80

/bin/ksh

I'm writing it in .sh
I cannot give samples of the file. But let me try to explain it roughly. If you receive your phone bill invoice/statement in the post it could be one - ten pages long showing the invoice total for example, what calls you made etc. This invoice file contains statements in free form (like in notepad) in no specific format and gets printed from there. Each invoice has a certain number of pages, so somewhere in the file it will say Page: 1 or 2 or whatever depending on the Account Number:. The other file is a comma delmited file giving details of each customer, like name, address and whether the invoice gets posted or emailed.
I need to pick up the account number from this txt file, pick up whether it gets posted or emailed and then in the invoice file count the number of pages that gets printed and posted and emailed per customer.
I know this is all confusing but basically I need to get information from a file where the data is not in a specific column or line. There is currently no manual process in place.
# 7  
Old 10-22-2004
Seems like you need to go through your second file (comma delimited file) and get the account information. Using the account number, you can then go through your invoice file. It still isn't clear to me if you are looking to grab all the pages of information for a specific account or not.

Once you have the account number, you could search through the invoice data and pull the information you need - one way would be the awk command - searching for a specific begining string and ending string. Your begining string would be the account number in the invoice file - the ending string I would not know since you can't post a sample. See the man page on awk - look for /start/, /stop/ which prints all lines between the start/stop pair. Then once you have all the pages, you do what you need to and go on to the next account number.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

UNIX Shell Scripting

Describe in short the word completion feature of the tcsh Completion works anywhere in the command line, not at just the end, for both commands and filenames. Type part of a word and hit the Tab key, and the shell replaces the incomplete word with the complete one in the input buffer. The... (1 Reply)
Discussion started by: Elena Lauren
1 Replies

2. Programming

unix Shell scripting

Hi All, need help to complete the automation but stuck at a perticular situation below is the code <code> fixed_function_name { code.... code.... variable_map= { a="/a" b="/b" c="/c" so on... } (7 Replies)
Discussion started by: yadavricky
7 Replies

3. Shell Programming and Scripting

UNIX shell scripting

I am new to Unix.. Can someone please help me to understand the concept of Login shell and non login shell ? what exactly the difference between them :confused: (1 Reply)
Discussion started by: lokita jain
1 Replies

4. UNIX for Dummies Questions & Answers

Unix Shell Scripting

I'm sorry if this doesn't go here, but I'm in depserate need of help with my last unix homework. Anyways, I'm taking summer classes, and one of them is UNIX. I've understood everything thus far, but I'm having a killer time with how my instructor has worded the problems for shell scripting. I... (3 Replies)
Discussion started by: dw15
3 Replies

5. UNIX for Dummies Questions & Answers

Unix Shell Scripting( Calling from Unix to PLSQL)

Hello Experts, I have the following questions to be discussed here at this esteemed discussion forum. I have two Excel sheets which contain Unix Commands llike creating directory the structure/ftp/Copy/Zip etc to basically create an environment. I need help in understanding some of... (1 Reply)
Discussion started by: faizsaadq
1 Replies

6. Shell Programming and Scripting

Unix Shell Scripting

I 'm new to unix shell scripting can some one guide me to any e-book or link from where i can learn unix shell scripting .. i want to learn create interactive scripts for my day to day solaris work. Any help would be appreciated (1 Reply)
Discussion started by: fugitive
1 Replies

7. UNIX for Advanced & Expert Users

Need your Help on Unix Shell Scripting.........

Hi Friends, 1. Bash Shell Scrpt to take backup at evening 2. I need a bash shell script for killing all processes. (5 Replies)
Discussion started by: vinayraj
5 Replies

8. Shell Programming and Scripting

Unix Shell Scripting

Hi All, Greetings!! I am trying to write a script that will get me the syslog.log file output of last week... That is ...my cron will run on Monday and will get me the syslog output of previous week , last monday-last sunday. I tried using date formatting and tail..but did not succeed.... (4 Replies)
Discussion started by: premamadhuri
4 Replies

9. Shell Programming and Scripting

Unix shell scripting

Hi, we are writing this fields dynamically retrieved from database and writing into the file. $bmpRec = $bmpRec.'|'.$cust_id; # sp4 $bmpRec = $bmpRec.'|'.$serv_id; # sp5 $bmpRec = $bmpRec.'|'.$site_id; # sp6 $bmpRec = $bmpRec.'|'.$loc_id; # sp7 ... (4 Replies)
Discussion started by: Maruthi Kunnuru
4 Replies

10. Shell Programming and Scripting

difference between AIX shell scripting and Unix shell scripting.

please give the difference between AIX shell scripting and Unix shell scripting. (2 Replies)
Discussion started by: haroonec
2 Replies
Login or Register to Ask a Question